de.jadv.lib.network
Class SyncByteBuffersForChannels

java.lang.Object
  |
  +--de.jadv.lib.network.SyncByteBuffersForChannels

public class SyncByteBuffersForChannels
extends java.lang.Object

Buffers to read/write through java.nio channels
The buffers are always in the position to write to them. So if you want to read from them do

 buffer.flip()
 read-Action
 buffer.compact()
 buffer.position(buffer.limit())
 buffer.limit(buffer.capazity())
 

Author:
neitzel

Field Summary
(package private)  java.nio.ByteBuffer inputBuffer
           
(package private)  java.nio.ByteBuffer outputBuffer
           
(package private)  long receivedBytes
           
(package private)  long sentBytes
           
 
Constructor Summary
SyncByteBuffersForChannels()
          Constructor for SyncByteBuffersForChannels.
SyncByteBuffersForChannels(int capacity)
           
SyncByteBuffersForChannels(int capacityIn, int capacityOut)
           
 
Method Summary
 JAdvEvent decodeEvent()
           
 long getReceivedBytes()
           
 long getSentBytes()
           
 int receiveData(java.nio.channels.SocketChannel sChannel)
           
 int sendData(java.nio.channels.SocketChannel sChannel)
           
 void sendEvent(JAdvEvent event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputBuffer

java.nio.ByteBuffer inputBuffer

outputBuffer

java.nio.ByteBuffer outputBuffer

sentBytes

long sentBytes

receivedBytes

long receivedBytes
Constructor Detail

SyncByteBuffersForChannels

public SyncByteBuffersForChannels()
Constructor for SyncByteBuffersForChannels.


SyncByteBuffersForChannels

public SyncByteBuffersForChannels(int capacity)

SyncByteBuffersForChannels

public SyncByteBuffersForChannels(int capacityIn,
                                  int capacityOut)
Method Detail

getReceivedBytes

public long getReceivedBytes()

getSentBytes

public long getSentBytes()

sendData

public int sendData(java.nio.channels.SocketChannel sChannel)
             throws java.io.IOException
java.io.IOException

receiveData

public int receiveData(java.nio.channels.SocketChannel sChannel)
                throws java.io.IOException
java.io.IOException

sendEvent

public void sendEvent(JAdvEvent event)

decodeEvent

public JAdvEvent decodeEvent()