public class RegularPacketReader extends java.lang.Object implements PacketReader
[header 1-4 bytes] => content size
[content] => 0-255/0-65535/0-16777215/0-2147483646
Note that the maximum size for 4 bytes is a signed 32 bit int, not unsigned.
SKIP_PACKET| Constructor and Description |
|---|
RegularPacketReader(int headerSize,
boolean bigEndian)
Creates a regular packet reader with the given header size.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
nextPacket(java.nio.ByteBuffer byteBuffer)
Create a new packet using the ByteBuffer given.
|
public RegularPacketReader(int headerSize,
boolean bigEndian)
headerSize - the header size, 1 - 4 bytes.bigEndian - big endian (largest byte first) or little endian (smallest byte first)public byte[] nextPacket(java.nio.ByteBuffer byteBuffer)
throws ProtocolViolationException
PacketReadernextPacket in interface PacketReaderbyteBuffer - the byte buffer to use.ProtocolViolationException - is there was an error constructing the packet.