org.metastatic.rsync.v2
Class BufferUtil

java.lang.Object
  |
  +--org.metastatic.rsync.v2.BufferUtil

public class BufferUtil
extends Object


Constructor Summary
BufferUtil()
           
 
Method Summary
static long getLong(ByteBuffer in)
          Get a long integer from the byte buffer.
static String getShortString(ByteBuffer in)
          Read a short string from the buffer.
static String getString(ByteBuffer in, int maxLength)
          Read a string from the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferUtil

public BufferUtil()
Method Detail

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:

Parameters:
in - The input buffer.
Returns:
The long integer.
Throws:
BufferUnderflowException - If there are not enough bytes in the buffer.