public class FrameWriterBuffer extends java.lang.Object implements WritableBuffer
WritableBuffer.ByteBufferWrapper| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CAPACITY |
| Constructor and Description |
|---|
FrameWriterBuffer()
Creates a new WritableBuffer with default capacity.
|
FrameWriterBuffer(int capacity)
Create a new WritableBuffer with the given capacity.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
array() |
int |
arrayOffset() |
void |
ensureRemaining(int requiredRemaining)
Ensures the the buffer has at least the requiredRemaining space specified.
|
boolean |
hasRemaining() |
int |
limit() |
int |
position() |
void |
position(int position) |
void |
put(byte b) |
void |
put(byte[] src,
int offset,
int length) |
void |
put(java.nio.ByteBuffer payload) |
void |
put(ReadableBuffer payload) |
void |
putDouble(double value) |
void |
putFloat(float value) |
void |
putInt(int value) |
void |
putLong(long value) |
void |
putShort(short value) |
int |
remaining() |
int |
transferTo(java.nio.ByteBuffer target)
Copy bytes from this buffer into the target buffer and compacts this buffer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitputpublic static final int DEFAULT_CAPACITY
public FrameWriterBuffer()
public FrameWriterBuffer(int capacity)
capacity - the inital capacity to allocate for this buffer.public byte[] array()
public int arrayOffset()
public void put(byte b)
put in interface WritableBufferpublic void putShort(short value)
putShort in interface WritableBufferpublic void putInt(int value)
putInt in interface WritableBufferpublic void putLong(long value)
putLong in interface WritableBufferpublic void putFloat(float value)
putFloat in interface WritableBufferpublic void putDouble(double value)
putDouble in interface WritableBufferpublic void put(byte[] src,
int offset,
int length)
put in interface WritableBufferpublic void put(java.nio.ByteBuffer payload)
put in interface WritableBufferpublic void put(ReadableBuffer payload)
put in interface WritableBufferpublic boolean hasRemaining()
hasRemaining in interface WritableBufferpublic int remaining()
remaining in interface WritableBufferpublic void ensureRemaining(int requiredRemaining)
The internal buffer will be doubled if the requested capacity is less than that amount or the buffer will be expanded to the full new requiredRemaining value.
ensureRemaining in interface WritableBufferrequiredRemaining - the minimum remaining bytes needed to meet the next write operation.public int position()
position in interface WritableBufferpublic void position(int position)
position in interface WritableBufferpublic int limit()
limit in interface WritableBufferpublic int transferTo(java.nio.ByteBuffer target)
Copy either all bytes written into this buffer (start to current position) or as many as will fit if the target capacity is less that the bytes written. Bytes not read from this buffer are moved to the front of the buffer and the position is reset to the end of the copied region.
target - The array to move bytes to from those written into this buffer.