|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.littleshoot.util.mina.MinaUtils
public class MinaUtils
Apache MINA utility functions.
| Constructor Summary | |
|---|---|
MinaUtils()
|
|
| Method Summary | |
|---|---|
static String |
getString(org.littleshoot.mina.common.ByteBuffer buf)
Reads an ASCII string from the buffer. |
static boolean |
isUdp(org.littleshoot.mina.common.IoSession session)
Determines whether or not the specified session is a UDP session. |
static void |
putUnsignedByte(org.littleshoot.mina.common.ByteBuffer bb,
int value)
Puts an unsigned byte into the buffer. |
static void |
putUnsignedByte(org.littleshoot.mina.common.ByteBuffer bb,
int position,
int value)
Puts an unsigned byte into the buffer. |
static void |
putUnsignedInt(org.littleshoot.mina.common.ByteBuffer bb,
int position,
long value)
Puts an unsigned byte into the buffer. |
static void |
putUnsignedInt(org.littleshoot.mina.common.ByteBuffer bb,
long value)
Puts an unsigned byte into the buffer. |
static void |
putUnsignedShort(org.littleshoot.mina.common.ByteBuffer bb,
int value)
Puts an unsigned byte into the buffer. |
static void |
putUnsignedShort(org.littleshoot.mina.common.ByteBuffer bb,
int position,
int value)
Puts an unsigned byte into the buffer. |
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 Collection<byte[]> |
splitToByteArrays(org.littleshoot.mina.common.ByteBuffer buffer,
int chunkSize)
Splits the specified ByteBuffer into smaller
ByteBuffers of the specified size. |
static String |
toAsciiString(org.littleshoot.mina.common.ByteBuffer buf)
Useful for debugging. |
static org.littleshoot.mina.common.ByteBuffer |
toBuf(String str)
Converts the specified String to a ByteBuffer. |
static byte[] |
toByteArray(org.littleshoot.mina.common.ByteBuffer buf)
Copies the specified buffer to a byte array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MinaUtils()
| Method Detail |
|---|
public static String toAsciiString(org.littleshoot.mina.common.ByteBuffer buf)
buf - The buffer to convert to a string.
public static String getString(org.littleshoot.mina.common.ByteBuffer buf)
buf - The buffer to read from.
public static byte[] toByteArray(org.littleshoot.mina.common.ByteBuffer buf)
buf - The buffer to copy.
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 Collection<byte[]> splitToByteArrays(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 void putUnsignedByte(org.littleshoot.mina.common.ByteBuffer bb,
int value)
bb - The buffer.value - The value to insert.
public static void putUnsignedByte(org.littleshoot.mina.common.ByteBuffer bb,
int position,
int value)
bb - The buffer.position - The index in the buffer to insert the value.value - The value to insert.
public static void putUnsignedShort(org.littleshoot.mina.common.ByteBuffer bb,
int value)
bb - The buffer.value - The value to insert.
public static void putUnsignedShort(org.littleshoot.mina.common.ByteBuffer bb,
int position,
int value)
bb - The buffer.position - The index in the buffer to insert the value.value - The value to insert.
public static void putUnsignedInt(org.littleshoot.mina.common.ByteBuffer bb,
long value)
bb - The buffer.value - The value to insert.
public static void putUnsignedInt(org.littleshoot.mina.common.ByteBuffer bb,
int position,
long value)
bb - The buffer.position - The index in the buffer to insert the value.value - The value to insert.public static org.littleshoot.mina.common.ByteBuffer toBuf(String str)
String to a ByteBuffer. The
string encoding is assumed to be ASCII.
str - The string to convert.
ByteBuffer.public static boolean isUdp(org.littleshoot.mina.common.IoSession session)
session - The session to check.
true if the session is a UDP session, otherwise
false.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||