|
XNIO version 1.2.1.GA | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.xnio.Buffers
public final class Buffers
Buffer utility methods.
Method Summary | ||
---|---|---|
static
|
clear(T buffer)
Clear a buffer. |
|
static Object |
createDumper(ByteBuffer buffer,
int indent,
int columns)
Create an object that returns the dumped form of the given byte buffer when its toString() method is called. |
|
static Object |
createDumper(CharBuffer buffer,
int indent,
int columns)
Create an object that returns the dumped form of the given character buffer when its toString() method is called. |
|
static BufferAllocator<ByteBuffer> |
createHeapByteBufferAllocator(int size)
Create a heap-based buffer allocator. |
|
static void |
dump(ByteBuffer buffer,
Appendable dest,
int indent,
int columns)
Dump a byte buffer to the given target. |
|
static void |
dump(CharBuffer buffer,
Appendable dest,
int indent,
int columns)
Dump a character buffer to the given target. |
|
static ByteBuffer |
fill(ByteBuffer buffer,
int value,
int count)
Fill a buffer with a repeated value. |
|
static CharBuffer |
fill(CharBuffer buffer,
int value,
int count)
Fill a buffer with a repeated value. |
|
static IntBuffer |
fill(IntBuffer buffer,
int value,
int count)
Fill a buffer with a repeated value. |
|
static LongBuffer |
fill(LongBuffer buffer,
long value,
int count)
Fill a buffer with a repeated value. |
|
static ShortBuffer |
fill(ShortBuffer buffer,
int value,
int count)
Fill a buffer with a repeated value. |
|
static
|
flip(T buffer)
Flip a buffer. |
|
static
|
limit(T buffer,
int limit)
Set the buffer limit. |
|
static
|
mark(T buffer)
Set the buffer mark. |
|
static
|
position(T buffer,
int position)
Set the buffer position. |
|
static
|
reset(T buffer)
Reset the buffer. |
|
static
|
rewind(T buffer)
Rewind the buffer. |
|
static
|
skip(T buffer,
int cnt)
Set a buffer's position relative to its current position. |
|
static ByteBuffer |
slice(ByteBuffer buffer,
int sliceSize)
Slice the buffer. |
|
static CharBuffer |
slice(CharBuffer buffer,
int sliceSize)
Slice the buffer. |
|
static IntBuffer |
slice(IntBuffer buffer,
int sliceSize)
Slice the buffer. |
|
static LongBuffer |
slice(LongBuffer buffer,
int sliceSize)
Slice the buffer. |
|
static ShortBuffer |
slice(ShortBuffer buffer,
int sliceSize)
Slice the buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T extends Buffer> T flip(T buffer)
T
- the buffer typebuffer
- the buffer to flip
Buffer.flip()
public static <T extends Buffer> T clear(T buffer)
T
- the buffer typebuffer
- the buffer to clear
Buffer.clear()
public static <T extends Buffer> T limit(T buffer, int limit)
T
- the buffer typebuffer
- the buffer to setlimit
- the new limit
Buffer.limit(int)
public static <T extends Buffer> T mark(T buffer)
T
- the buffer typebuffer
- the buffer to mark
Buffer.mark()
public static <T extends Buffer> T position(T buffer, int position)
T
- the buffer typebuffer
- the buffer to setposition
- the new position
Buffer.position(int)
public static <T extends Buffer> T reset(T buffer)
T
- the buffer typebuffer
- the buffer to reset
Buffer.reset()
public static <T extends Buffer> T rewind(T buffer)
T
- the buffer typebuffer
- the buffer to rewind
Buffer.rewind()
public static ByteBuffer slice(ByteBuffer buffer, int sliceSize)
buffer
- the buffer to slicesliceSize
- the size of the slice
ByteBuffer.slice()
public static ByteBuffer fill(ByteBuffer buffer, int value, int count)
buffer
- the buffer to fillvalue
- the value to fillcount
- the number of bytes to fill
public static CharBuffer slice(CharBuffer buffer, int sliceSize)
buffer
- the buffer to slicesliceSize
- the size of the slice
CharBuffer.slice()
public static CharBuffer fill(CharBuffer buffer, int value, int count)
buffer
- the buffer to fillvalue
- the value to fillcount
- the number of chars to fill
public static ShortBuffer slice(ShortBuffer buffer, int sliceSize)
buffer
- the buffer to slicesliceSize
- the size of the slice
ShortBuffer.slice()
public static ShortBuffer fill(ShortBuffer buffer, int value, int count)
buffer
- the buffer to fillvalue
- the value to fillcount
- the number of shorts to fill
public static IntBuffer slice(IntBuffer buffer, int sliceSize)
buffer
- the buffer to slicesliceSize
- the size of the slice
IntBuffer.slice()
public static IntBuffer fill(IntBuffer buffer, int value, int count)
buffer
- the buffer to fillvalue
- the value to fillcount
- the number of ints to fill
public static LongBuffer slice(LongBuffer buffer, int sliceSize)
buffer
- the buffer to slicesliceSize
- the size of the slice
LongBuffer.slice()
public static LongBuffer fill(LongBuffer buffer, long value, int count)
buffer
- the buffer to fillvalue
- the value to fillcount
- the number of longs to fill
public static <T extends Buffer> T skip(T buffer, int cnt)
T
- the buffer typebuffer
- the buffer to setcnt
- the distantce to skip
Buffer.position(int)
public static Object createDumper(ByteBuffer buffer, int indent, int columns)
toString()
method is called.
Useful for logging byte buffers; if the toString()
method is never called, the process of dumping the
buffer is never performed.
buffer
- the bufferindent
- the indentation to usecolumns
- the number of 8-byte columns
public static void dump(ByteBuffer buffer, Appendable dest, int indent, int columns) throws IOException
buffer
- the bufferdest
- the targetindent
- the indentation to usecolumns
- the number of 8-byte columns
IOException
- if an error occurs during appendpublic static Object createDumper(CharBuffer buffer, int indent, int columns)
toString()
method is called.
Useful for logging character buffers; if the toString()
method is never called, the process of dumping the
buffer is never performed.
buffer
- the bufferindent
- the indentation to usecolumns
- the number of 8-byte columns
public static void dump(CharBuffer buffer, Appendable dest, int indent, int columns) throws IOException
buffer
- the bufferdest
- the targetindent
- the indentation to usecolumns
- the number of 8-byte columns
IOException
- if an error occurs during appendpublic static BufferAllocator<ByteBuffer> createHeapByteBufferAllocator(int size)
size
- the size of the returned buffers
|
XNIO version 1.2.1.GA | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |