org.metastatic.rsync.v2
Class BufferUtil
java.lang.Object
|
+--org.metastatic.rsync.v2.BufferUtil
- public class BufferUtil
- extends Object
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BufferUtil
public BufferUtil()
getString
public static String getString(ByteBuffer in,
int maxLength)
- Read a string from the buffer.
- Parameters:
in
- The input buffer.maxLength
- The maximum number of bytes to read, or 0 if not
limited.
- Returns:
- The string.
- Throws:
BufferOverflowException
- If the string length is greater
than maxLength.
BufferUnderflowException
- If there are not enough
bytes available in the buffer.
getShortString
public static String getShortString(ByteBuffer in)
- Read a short string from the buffer.
- Parameters:
in
- The input buffer.
- Returns:
- The string.
- Throws:
BufferUnderflowException
- If there are not enough
bytes available in the buffer.
getLong
public static long getLong(ByteBuffer in)
- Get a long integer from the byte buffer. The semantics of the
integer read are as follows:
- If the first four bytes do not equal the integer
0xFFFFFFFF, return these four bytes, and don't read
anything else.
- Otherwise, read eight more bytes and return that as the long
integer.
- Parameters:
in
- The input buffer.
- Returns:
- The long integer.
- Throws:
BufferUnderflowException
- If there are not enough bytes in
the buffer.