com.tangosol.util
Class BinaryWriteBuffer
java.lang.Object
com.tangosol.io.AbstractWriteBuffer
com.tangosol.io.ByteArrayWriteBuffer
com.tangosol.util.BinaryWriteBuffer
- All Implemented Interfaces:
- WriteBuffer
public final class BinaryWriteBuffer
- extends ByteArrayWriteBuffer
a WriteBuffer implementation whose primary purpose is to be used to create
Binary objects.
- Author:
- cp 2005.06.02
Constructor Summary |
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. |
Method Summary |
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. |
Methods inherited from class com.tangosol.io.ByteArrayWriteBuffer |
copyStream, getBufferOutput, getCapacity, getMaximumCapacity, getRawByteArray, getUnsafeReadBuffer, grow, isByteArrayPrivate, length, makeByteArrayPrivate, retain, updateLength, write, write, write, write |
Methods inherited from class com.tangosol.io.AbstractWriteBuffer |
clear, clone, getAppendingBufferOutput, getBufferOutput, getReadBuffer, getWriteBuffer, getWriteBuffer, retain, tmpbuf, tmpbuf, toByteArray, write, write, write |
BinaryWriteBuffer
public BinaryWriteBuffer(int cbCap)
- Construct an BinaryWriteBuffer with a certain initial capacity.
- Parameters:
cbCap
- initial capacity
- Throws:
IllegalArgumentException
- if cbCap is negative
BinaryWriteBuffer
public BinaryWriteBuffer(int cbCap,
int cbMax)
- Construct an BinaryWriteBuffer with a certain initial capacity and
a certain maximum capacity.
- Parameters:
cbCap
- initial capacitycbMax
- maximum capacity
- Throws:
IllegalArgumentException
- if cbCap or cbMax
is negative, or if cbCap is greater than
cbMax
toBinary
public Binary toBinary()
- Returns a new Binary object that holds the complete contents of this
WriteBuffer.
This method is functionally equivalent to the following code:
return getUnsafeReadBuffer().toBinary();
- Specified by:
toBinary
in interface WriteBuffer
- Overrides:
toBinary
in class AbstractWriteBuffer
- Returns:
- the contents of this WriteBuffer as a Binary object
checkBounds
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.
Prevents all modifications from occurring once the WriteBuffer has
supplied it byte array to a Binary object.
- Overrides:
checkBounds
in class ByteArrayWriteBuffer
- Parameters:
of
- the offset that data is about to be written tocb
- the length of the data that is about to be written