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, wait
put
public 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 WritableBuffer
public void putShort(short value)
putShort
in interface WritableBuffer
public void putInt(int value)
putInt
in interface WritableBuffer
public void putLong(long value)
putLong
in interface WritableBuffer
public void putFloat(float value)
putFloat
in interface WritableBuffer
public void putDouble(double value)
putDouble
in interface WritableBuffer
public void put(byte[] src, int offset, int length)
put
in interface WritableBuffer
public void put(java.nio.ByteBuffer payload)
put
in interface WritableBuffer
public void put(ReadableBuffer payload)
put
in interface WritableBuffer
public boolean hasRemaining()
hasRemaining
in interface WritableBuffer
public int remaining()
remaining
in interface WritableBuffer
public 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 WritableBuffer
requiredRemaining
- the minimum remaining bytes needed to meet the next write operation.public int position()
position
in interface WritableBuffer
public void position(int position)
position
in interface WritableBuffer
public int limit()
limit
in interface WritableBuffer
public 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.