public interface StreamBuffer
| Modifier and Type | Method and Description |
|---|---|
StreamBuffer |
advance(int relPosition)
Adjust the position by a relative amount.
|
StreamBuffer |
clear()
Clear the contents of the stream buffer, setting position and length to 0.
|
StreamBuffer |
clear(int clearBytes)
Clear bytes from the current position, cutting them from the buffer.
|
void |
consolidateAndFree()
Copies buffer contents into a single heap buffer and frees unused buffers.
|
StreamBuffer |
duplicate() |
StreamBuffer |
duplicate(int viewLength) |
StreamBuffer |
flip()
Sets the position of the buffer to 0 and resets the insert mode.
|
byte |
get()
Read a byte from the underlying buffers.
|
int |
get(byte[] dst)
Read bytes from the underlying buffers into a byte array.
|
int |
get(byte[] dst,
int offset,
int length)
Read bytes from the underlying buffers into a byte array, starting at
the provided offset and reading a total of length bytes.
|
int |
get(java.nio.ByteBuffer dst)
Read as many bytes as possible from the underlying buffers into a byte buffer.
|
char |
getChar()
Read a char from the underlying buffers.
|
double |
getDouble()
Read a double from the underlying buffers.
|
float |
getFloat()
Read a float from the underlying buffers.
|
int |
getInt()
Read an integer from the underlying buffers.
|
long |
getLong()
Read a long from the underlying buffers.
|
short |
getShort()
Read a short from the underlying buffers.
|
void |
growthPolicy(boolean newGrowth)
Set the current growth policy, defaulting to true.
|
boolean |
hasRemaining() |
StreamBuffer |
insert(boolean newInsert)
Set the current insert mode.
|
int |
length() |
int |
position() |
StreamBuffer |
position(int newPosition)
Set the current buffer position.
|
void |
preAllocate(int minLength)
Pre-allocate buffers for writing, extending the length to the passed size.
|
StreamBuffer |
put(byte value)
Write a byte to the underlying buffers, allocating more if needed.
|
StreamBuffer |
put(byte[] src)
Write a byte array to the underlying buffers, allocating more if needed.
|
StreamBuffer |
put(byte[] src,
int offset,
int length)
Write part of a byte array to the underlying buffers, starting at the
provided offset and limited by the provided length, allocating more if
needed.
|
StreamBuffer |
put(java.nio.ByteBuffer... srcBuffers)
Write ByteBuffer contents to the underlying buffers,
allocating more if needed.
|
StreamBuffer |
putChar(char value)
Write a char to the underlying buffers, allocating more if needed.
|
StreamBuffer |
putDouble(double value)
Write a double to the underlying buffers, allocating more if needed.
|
StreamBuffer |
putFloat(float value)
Write a float to the underlying buffers, allocating more if needed.
|
StreamBuffer |
putInt(int value)
Write an integer to the underlying buffers, allocating more if needed.
|
StreamBuffer |
putLong(long value)
Write a long to the underlying buffers, allocating more if needed.
|
StreamBuffer |
putNoCopy(java.nio.ByteBuffer... ncBuffers)
Add ByteBuffers to the list of underlying buffers, the position is
advanced by the content length.
|
StreamBuffer |
putShort(short value)
Write a short to the underlying buffers, allocating more if needed.
|
void |
recyclePolicy(boolean newRecyle)
Set the current recycle policy, defaulting to false.
|
int |
remaining() |
StreamBuffer |
rewind()
Sets the position of the buffer to 0 and resets the insert mode.
|
byte[] |
toByteArray()
Obtain the contents of this buffer as a byte array.
|
java.nio.ByteBuffer[] |
toByteBuffers()
Obtain the contents of this buffer as byte buffers.
|
int length()
int position()
StreamBuffer position(int newPosition)
newPosition - An int from 0 to the length of the buffer.StreamBuffer advance(int relPosition)
relPosition - The relative number of bytes to adjust the position.int remaining()
boolean hasRemaining()
StreamBuffer insert(boolean newInsert)
newInsert - True to insert, false to overwritevoid growthPolicy(boolean newGrowth)
newGrowth - True to grow, false to limit puts to the length.void recyclePolicy(boolean newRecyle)
newGrowth - True to recycle cleared buffers, false to discard them.StreamBuffer flip()
StreamBuffer rewind()
StreamBuffer clear()
StreamBuffer clear(int clearBytes)
clearBytes - - The number of bytes to clear from the current position.StreamBuffer duplicate()
StreamBuffer duplicate(int viewLength)
viewLength - - The number of bytes from the current position to include.void preAllocate(int minLength)
minLength - void consolidateAndFree()
StreamBuffer put(byte value)
value - The byte to write to buffer.StreamBuffer putChar(char value)
value - The char to write to buffer.StreamBuffer putShort(short value)
value - The short to write to buffer.StreamBuffer putInt(int value)
value - The integer to write to buffer.StreamBuffer putLong(long value)
value - The long to write to buffer.StreamBuffer putFloat(float value)
value - The float to write to buffer.StreamBuffer putDouble(double value)
value - The double to write to buffer.StreamBuffer put(byte[] src)
src - The byte array to write to buffer.StreamBuffer put(byte[] src, int offset, int length)
value - The byte array to write to buffer.offset - The starting offset in the byte array.length - The number of bytes to write from the offset.StreamBuffer put(java.nio.ByteBuffer... srcBuffers)
srcBuffers - One or more ByteBuffers to copy into this buffer.StreamBuffer putNoCopy(java.nio.ByteBuffer... ncBuffers)
ncBuffers - One or more byte buffers to copy into this buffer.byte get()
char getChar()
short getShort()
int getInt()
long getLong()
float getFloat()
double getDouble()
int get(byte[] dst)
dst - The byte array to read into.int get(byte[] dst,
int offset,
int length)
dst - The byte array to read into.offset - The starting offset in the byte array.length - The number of bytes to read into the byte array.int get(java.nio.ByteBuffer dst)
dst - The byte buffer to read into.byte[] toByteArray()
java.nio.ByteBuffer[] toByteBuffers()