| java.lang.Object com.sleepycat.bind.tuple.TupleBase
All known Subclasses: com.sleepycat.bind.serial.TupleSerialKeyCreator, com.sleepycat.bind.tuple.TupleBinding, com.sleepycat.bind.tuple.TupleTupleBinding, com.sleepycat.bind.tuple.TupleTupleKeyCreator, com.sleepycat.bind.serial.TupleSerialBinding,
TupleBase | public class TupleBase (Code) | | A base class for tuple bindings and tuple key creators that provides control
over the allocation of the output buffer.
Tuple bindings and key creators append data to a
TupleOutput instance, which is also a
com.sleepycat.util.FastOutputStream instance. This object has a byte array buffer that is resized when it is
full. The reallocation of this buffer can be a performance factor for
some applications using large objects. To manage this issue, the
TupleBase.setTupleBufferSize method may be used to control the initial size of the
buffer, and the
TupleBase.getTupleOutput method may be overridden by
subclasses to take over creation of the TupleOutput object.
|
Constructor Summary | |
public | TupleBase() Initializes the initial output buffer size to zero. |
Method Summary | |
public static TupleInput | entryToInput(DatabaseEntry entry) Utility method to create a new tuple input object for reading the data
from a given buffer. | public int | getTupleBufferSize() Returns the initial byte size of the output buffer. | protected TupleOutput | getTupleOutput(Object object) Returns an empty TupleOutput instance that will be used by the tuple
binding or key creator.
The default implementation of this method creates a new TupleOutput
with an initial buffer size that can be changed using the
TupleBase.setTupleBufferSize method.
This method may be overridden to return a TupleOutput instance. | public static void | inputToEntry(TupleInput input, DatabaseEntry entry) Utility method to set the data in a entry buffer to the data in a tuple
input object. | public static TupleOutput | newOutput() Utility method for use by bindings to create a tuple output object. | public static TupleOutput | newOutput(byte[] buffer) Utility method for use by bindings to create a tuple output object
with a specific starting size. | public static void | outputToEntry(TupleOutput output, DatabaseEntry entry) Utility method to set the data in a entry buffer to the data in a tuple
output object. | public void | setTupleBufferSize(int byteSize) Sets the initial byte size of the output buffer that is allocated by the
default implementation of
TupleBase.getTupleOutput . |
entryToInput | public static TupleInput entryToInput(DatabaseEntry entry)(Code) | | Utility method to create a new tuple input object for reading the data
from a given buffer. If an existing input is reused, it is reset before
returning it.
Parameters: entry - is the source entry buffer. the new tuple input object. |
getTupleBufferSize | public int getTupleBufferSize()(Code) | | Returns the initial byte size of the output buffer.
the initial byte size of the output buffer. See Also: TupleBase.setTupleBufferSize |
getTupleOutput | protected TupleOutput getTupleOutput(Object object)(Code) | | Returns an empty TupleOutput instance that will be used by the tuple
binding or key creator.
The default implementation of this method creates a new TupleOutput
with an initial buffer size that can be changed using the
TupleBase.setTupleBufferSize method.
This method may be overridden to return a TupleOutput instance. For
example, an instance per thread could be created and returned by this
method. If a TupleOutput instance is reused, be sure to call its
com.sleepycat.util.FastOutputStream.reset method before each
use.
Parameters: object - is the object to be written to the tuple output, and maybe used by subclasses to determine the size of the output buffer. an empty TupleOutput instance. See Also: TupleBase.setTupleBufferSize |
inputToEntry | public static void inputToEntry(TupleInput input, DatabaseEntry entry)(Code) | | Utility method to set the data in a entry buffer to the data in a tuple
input object.
Parameters: input - is the source tuple input object. Parameters: entry - is the destination entry buffer. |
newOutput | public static TupleOutput newOutput(byte[] buffer)(Code) | | Utility method for use by bindings to create a tuple output object
with a specific starting size.
a new tuple output object.TupleBase.getTupleOutput |
outputToEntry | public static void outputToEntry(TupleOutput output, DatabaseEntry entry)(Code) | | Utility method to set the data in a entry buffer to the data in a tuple
output object.
Parameters: output - is the source tuple output object. Parameters: entry - is the destination entry buffer. |
|
|