|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.littleshoot.util.mina.ByteBufferUtils
public final class ByteBufferUtils
Utility class for manipulating ByteBuffers.
| Constructor Summary | |
|---|---|
ByteBufferUtils()
|
|
| Method Summary | |
|---|---|
static org.littleshoot.mina.common.ByteBuffer |
combine(Collection<org.littleshoot.mina.common.ByteBuffer> buffers)
Combines the remaining data from the given Collection of
ByteBuffers into a single consolidated
ByteBuffer. |
static void |
logBufferToWrite(org.littleshoot.mina.common.ByteBuffer buffer)
Logs the data contained in a ByteBuffer that's ready
to be written to the network. |
static int |
remaining(Collection<org.littleshoot.mina.common.ByteBuffer> buffers)
|
static Collection<org.littleshoot.mina.common.ByteBuffer> |
split(org.littleshoot.mina.common.ByteBuffer buffer,
int chunkSize)
Splits the specified ByteBuffer into smaller
ByteBuffers of the specified size. |
static String |
toString(org.littleshoot.mina.common.ByteBuffer buffer)
Returns the buffer as a string while preserving the buffer position and limit. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ByteBufferUtils()
| Method Detail |
|---|
public static Collection<org.littleshoot.mina.common.ByteBuffer> split(org.littleshoot.mina.common.ByteBuffer buffer,
int chunkSize)
ByteBuffer into smaller
ByteBuffers of the specified size. The remaining bytes
in the buffer must be greater than the chunk size. This method will
create smaller buffers of the specified size until there are fewer
remaining bytes than the chunk size, when it will simply add a buffer
the same size as the number of bytes remaining.
buffer - The ByteBuffer to split.chunkSize - The size of the smaller buffers to create.
Collection of ByteBuffers of the
specified size. The final buffer in the Collection will
have a size > 0 and <= the chunk size.public static org.littleshoot.mina.common.ByteBuffer combine(Collection<org.littleshoot.mina.common.ByteBuffer> buffers)
Collection of
ByteBuffers into a single consolidated
ByteBuffer.
buffers - The Collection of ByteBuffers
to make into a single buffer.
ByteBuffer combining the remaining data of
the Collection of ByteBuffers.public static int remaining(Collection<org.littleshoot.mina.common.ByteBuffer> buffers)
public static void logBufferToWrite(org.littleshoot.mina.common.ByteBuffer buffer)
ByteBuffer that's ready
to be written to the network.
buffer - The buffer to log.public static String toString(org.littleshoot.mina.common.ByteBuffer buffer)
buffer - The buffer to create a string from.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||