Skip navigation links
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.
This method is functionally equivalent to the following code:
return getUnsafeReadBuffer().toBinary();
|
Methods inherited from class com.tangosol.io.ByteArrayWriteBuffer |
copyStream, getBufferOutput, getCapacity, getMaximumCapacity, getRawByteArray, getUnsafeReadBuffer, grow, isByteArrayPrivate, length, makeByteArrayPrivate, retain, setLength, toByteArray, updateLength, write, write, write, write |
Methods inherited from class com.tangosol.io.AbstractWriteBuffer |
clear, clone, copyBufferInputPortion, copyBufferInputRemainder, getAppendingBufferOutput, getBufferOutput, getReadBuffer, getWriteBuffer, getWriteBuffer, releaseBuffers, retain, tmpbuf, tmpbuf, 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 capacity
cbMax
- 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 ByteArrayWriteBuffer
-
- 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. <p/> Note: This method prevents all modifications from occurring once the BinaryWriteBuffer has supplied its byte array to a Binary object.
-
- Overrides:
checkBounds
in class ByteArrayWriteBuffer
-
- Parameters:
of
- the offset that data is about to be written to
cb
- the length of the data that is about to be written
Skip navigation links
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.