public final class PacketUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkBufferLength(int byteLength,
int offset,
int length)
Check the length of the input buffer is appropriate given the offset and
length parameters.
|
static void |
checkHeaderLength(int givenLength,
int requiredLength)
Check that there are enough bytes in the buffer to read some number of
bytes that we need to read a full header.
|
static void |
checkInput(byte[] data,
int offset,
int length,
int requiredLength)
Check the input parameters are sane and there's enough bytes to read
the required length.
|
public static void checkBufferLength(int byteLength,
int offset,
int length)
throws DeserializationException
byteLength - length of the input buffer arrayoffset - offset given to begin reading bytes fromlength - length given to read up untilDeserializationException - if the input parameters don't match up (i.e
we can't read that many bytes from the buffer at the given offest)public static void checkHeaderLength(int givenLength,
int requiredLength)
throws DeserializationException
givenLength - given size of the bufferrequiredLength - number of bytes we need to read some header fullyDeserializationException - if there aren't enough bytespublic static void checkInput(byte[] data,
int offset,
int length,
int requiredLength)
throws DeserializationException
data - input byte bufferoffset - offset of the start of the headerlength - length given to deserialize the headerrequiredLength - length needed to deserialize headerDeserializationException - if we're unable to deserialize the
packet based on the input parameters