public final class BinaryWriteBuffer extends ByteArrayWriteBuffer
ByteArrayWriteBuffer.Allocator, ByteArrayWriteBuffer.ByteArrayBufferOutputAbstractWriteBuffer.AbstractBufferOutputWriteBuffer.BufferOutputm_ab, m_bufUnsafe, m_cb, m_cbMaxCHAR_BUF_MASK, CHAR_BUF_SIZE, m_achBuf, NO_BINARY, NO_BYTES| Constructor and Description |
|---|
BinaryWriteBuffer(int cbCap)
Construct an BinaryWriteBuffer with a certain initial capacity.
|
BinaryWriteBuffer(int cbCap, int cbMax)
Construct an BinaryWriteBuffer with a certain initial capacity and a certain maximum capacity.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkBounds(int of, int cb)
Validate the ranges for the passed bounds and make sure that the underlying array is big enough to handle them.
|
Binary |
toBinary()
Returns a new Binary object that holds the complete contents of this WriteBuffer.
|
copyStream, createBytes, getBufferOutput, getCapacity, getMaximumCapacity, getRawByteArray, getUnsafeReadBuffer, grow, isByteArrayPrivate, length, makeByteArrayPrivate, retain, setLength, toByteArray, updateLength, write, write, write, writeclear, clone, copyBufferInputPortion, copyBufferInputRemainder, getAppendingBufferOutput, getBufferOutput, getReadBuffer, getWriteBuffer, getWriteBuffer, releaseBuffers, retain, tmpbuf, tmpbuf, write, write, writepublic BinaryWriteBuffer(int cbCap)
cbCap - initial capacityIllegalArgumentException - if cbCap is negative
public BinaryWriteBuffer(int cbCap,
int cbMax)
cbCap - initial capacitycbMax - maximum capacityIllegalArgumentException - if cbCap or cbMax is negative, or if cbCap is greater than cbMaxpublic Binary toBinary()
This method is functionally equivalent to the following code:
return getUnsafeReadBuffer().toBinary();
toBinary in interface WriteBuffertoBinary in class ByteArrayWriteBuffer
protected void checkBounds(int of,
int cb)
Note: This method prevents all modifications from occurring once the BinaryWriteBuffer has supplied its byte array to a Binary object.
checkBounds in class ByteArrayWriteBufferof - the offset that data is about to be written tocb - the length of the data that is about to be written