|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnaga.packetreader.RawPacketReader
public class RawPacketReader
This packet reader reads as many bytes as possible from the stream and then bundles those bytes into a packet.
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER_SIZE
|
Constructor Summary | |
---|---|
RawPacketReader()
Create a new reader instance with the default buffer size. |
|
RawPacketReader(int bufferSize)
Create a new reader instance. |
Method Summary | |
---|---|
java.nio.ByteBuffer |
getBuffer()
Return the currently used byte buffer. |
byte[] |
getNextPacket()
Return the next packet constructed from the data read in the buffers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUFFER_SIZE
Constructor Detail |
---|
public RawPacketReader(int bufferSize)
bufferSize
- the buffer size to use.public RawPacketReader()
Method Detail |
---|
public java.nio.ByteBuffer getBuffer()
PacketReader
The reader is guaranteed not to have this method called more than once before a
call to PacketReader#getNextPacket()
is made.
getBuffer
in interface PacketReader
public byte[] getNextPacket() throws ProtocolViolationException
PacketReader
This call may or may not have been proceeded by a call to getBuffer().
The calling thread will call this method repeatedly until it returns null.
getNextPacket
in interface PacketReader
ProtocolViolationException
- if a protocol violation was detected when
parsing the next packet.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |