Oracle® Coherence Java API Reference
v3.5

E14977-01

com.tangosol.util
Class BinaryWriteBuffer

java.lang.Object
  extended by com.tangosol.io.AbstractWriteBuffer
      extended by com.tangosol.io.ByteArrayWriteBuffer
          extended by 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

Nested Class Summary
 
Nested classes/interfaces inherited from class com.tangosol.io.ByteArrayWriteBuffer
ByteArrayWriteBuffer.Allocator, ByteArrayWriteBuffer.ByteArrayBufferOutput
 
Nested classes/interfaces inherited from class com.tangosol.io.AbstractWriteBuffer
AbstractWriteBuffer.AbstractBufferOutput
 
Nested classes/interfaces inherited from interface com.tangosol.io.WriteBuffer
WriteBuffer.BufferOutput
 
Field Summary
 
Fields inherited from class com.tangosol.io.ByteArrayWriteBuffer
m_ab, m_bufUnsafe, m_cb, m_cbMax
 
Fields inherited from class com.tangosol.io.AbstractWriteBuffer
CHAR_BUF_MASK, CHAR_BUF_SIZE, m_achBuf, NO_BINARY, NO_BYTES
 
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, copyBufferInputPortion, copyBufferInputRemainder, getAppendingBufferOutput, getBufferOutput, getReadBuffer, getWriteBuffer, getWriteBuffer, retain, tmpbuf, tmpbuf, toByteArray, write, write, write
 

Constructor Detail

BinaryWriteBuffer

public BinaryWriteBuffer(int cbCap)
Construct an BinaryWriteBuffer with a certain initial capacity.

Parameters:
cbCap - initial capacity
Throws:
java.lang.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:
java.lang.IllegalArgumentException - if cbCap or cbMax is negative, or if cbCap is greater than cbMax
Method Detail

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 to
cb - the length of the data that is about to be written

Oracle® Coherence Java API Reference
v3.5

E14977-01

Copyright © 2000, 2009, Oracle. All rights reserved.