Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

com::sleepycat::bind::tuple::TupleBase Class Reference

Inheritance diagram for com::sleepycat::bind::tuple::TupleBase:

com::sleepycat::bind::serial::TupleSerialBinding com::sleepycat::bind::serial::TupleSerialKeyCreator com::sleepycat::bind::tuple::TupleBinding com::sleepycat::bind::tuple::TupleTupleBinding com::sleepycat::bind::tuple::TupleTupleKeyCreator com::sleepycat::bind::serial::TupleSerialMarshalledBinding com::sleepycat::bind::serial::TupleSerialMarshalledKeyCreator com::sleepycat::bind::tuple::BooleanBinding com::sleepycat::bind::tuple::ByteBinding com::sleepycat::bind::tuple::CharacterBinding com::sleepycat::bind::tuple::DoubleBinding com::sleepycat::bind::tuple::FloatBinding com::sleepycat::bind::tuple::IntegerBinding com::sleepycat::bind::tuple::LongBinding com::sleepycat::bind::tuple::ShortBinding com::sleepycat::bind::tuple::StringBinding com::sleepycat::bind::tuple::TupleMarshalledBinding com::sleepycat::bind::tuple::TupleTupleMarshalledBinding com::sleepycat::bind::tuple::TupleTupleMarshalledKeyCreator

Public Member Functions

 TupleBase ()
void setTupleBufferSize (int byteSize)
int getTupleBufferSize ()

Static Public Member Functions

static void outputToEntry (TupleOutput output, DatabaseEntry entry)
static void inputToEntry (TupleInput input, DatabaseEntry entry)
static TupleInput entryToInput (DatabaseEntry entry)
static TupleOutput newOutput ()
static TupleOutput newOutput (byte[] buffer)

Protected Member Functions

TupleOutput getTupleOutput (Object object)

Detailed Description

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 setTupleBufferSize method may be used to control the initial size of the buffer, and the getTupleOutput method may be overridden by subclasses to take over creation of the TupleOutput object.

Definition at line 27 of file TupleBase.java.


Constructor & Destructor Documentation

com::sleepycat::bind::tuple::TupleBase::TupleBase  )  [inline]
 

Initializes the initial output buffer size to zero.

Unless setTupleBufferSize is called, the default com.sleepycat.util.FastOutputStream#DEFAULT_INIT_SIZE size will be used.

Definition at line 38 of file TupleBase.java.


Member Function Documentation

static TupleInput com::sleepycat::bind::tuple::TupleBase::entryToInput DatabaseEntry  entry  )  [inline, static]
 

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.
Returns:
the new tuple input object.

Definition at line 134 of file TupleBase.java.

Referenced by com::sleepycat::bind::tuple::BooleanBinding::entryToBoolean(), com::sleepycat::bind::tuple::ByteBinding::entryToByte(), com::sleepycat::bind::tuple::CharacterBinding::entryToChar(), com::sleepycat::bind::tuple::DoubleBinding::entryToDouble(), com::sleepycat::bind::tuple::FloatBinding::entryToFloat(), com::sleepycat::bind::tuple::IntegerBinding::entryToInt(), com::sleepycat::bind::tuple::LongBinding::entryToLong(), com::sleepycat::bind::tuple::TupleBinding::entryToObject(), com::sleepycat::bind::serial::TupleSerialBinding::entryToObject(), com::sleepycat::bind::tuple::ShortBinding::entryToShort(), and com::sleepycat::bind::tuple::StringBinding::entryToString().

int com::sleepycat::bind::tuple::TupleBase::getTupleBufferSize  )  [inline]
 

Returns the initial byte size of the output buffer.

Returns:
the initial byte size of the output buffer.
See also:
setTupleBufferSize

Definition at line 63 of file TupleBase.java.

Referenced by getTupleOutput().

TupleOutput com::sleepycat::bind::tuple::TupleBase::getTupleOutput Object  object  )  [inline, protected]
 

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 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 may be used by subclasses to determine the size of the output buffer.
Returns:
an empty TupleOutput instance.
See also:
setTupleBufferSize

Reimplemented in com::sleepycat::bind::tuple::BooleanBinding, com::sleepycat::bind::tuple::ByteBinding, com::sleepycat::bind::tuple::CharacterBinding, com::sleepycat::bind::tuple::DoubleBinding, com::sleepycat::bind::tuple::FloatBinding, com::sleepycat::bind::tuple::IntegerBinding, com::sleepycat::bind::tuple::LongBinding, com::sleepycat::bind::tuple::ShortBinding, and com::sleepycat::bind::tuple::StringBinding.

Definition at line 88 of file TupleBase.java.

References getTupleBufferSize().

Referenced by com::sleepycat::bind::tuple::TupleTupleBinding::objectToData(), com::sleepycat::bind::tuple::TupleBinding::objectToEntry(), com::sleepycat::bind::tuple::TupleTupleBinding::objectToKey(), and com::sleepycat::bind::serial::TupleSerialBinding::objectToKey().

static void com::sleepycat::bind::tuple::TupleBase::inputToEntry TupleInput  input,
DatabaseEntry  entry
[inline, static]
 

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.
entry is the destination entry buffer.

Definition at line 119 of file TupleBase.java.

References com::sleepycat::util::FastInputStream::getBufferBytes(), com::sleepycat::util::FastInputStream::getBufferLength(), and com::sleepycat::util::FastInputStream::getBufferOffset().

static TupleOutput com::sleepycat::bind::tuple::TupleBase::newOutput byte[]  buffer  )  [inline, static]
 

Utility method for use by bindings to create a tuple output object with a specific starting size.

Returns:
a new tuple output object.
Deprecated:
replaced by getTupleOutput

Definition at line 160 of file TupleBase.java.

static TupleOutput com::sleepycat::bind::tuple::TupleBase::newOutput  )  [inline, static]
 

Utility method for use by bindings to create a tuple output object.

Returns:
a new tuple output object.
Deprecated:
replaced by getTupleOutput

Definition at line 147 of file TupleBase.java.

static void com::sleepycat::bind::tuple::TupleBase::outputToEntry TupleOutput  output,
DatabaseEntry  entry
[inline, static]
 

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.
entry is the destination entry buffer.

Definition at line 105 of file TupleBase.java.

References com::sleepycat::util::FastOutputStream::getBufferBytes(), com::sleepycat::util::FastOutputStream::getBufferLength(), and com::sleepycat::util::FastOutputStream::getBufferOffset().

Referenced by com::sleepycat::bind::tuple::BooleanBinding::booleanToEntry(), com::sleepycat::bind::tuple::ByteBinding::byteToEntry(), com::sleepycat::bind::tuple::CharacterBinding::charToEntry(), com::sleepycat::bind::tuple::DoubleBinding::doubleToEntry(), com::sleepycat::bind::tuple::FloatBinding::floatToEntry(), com::sleepycat::bind::tuple::IntegerBinding::intToEntry(), com::sleepycat::bind::tuple::LongBinding::longToEntry(), com::sleepycat::bind::tuple::TupleTupleBinding::objectToData(), com::sleepycat::bind::tuple::TupleBinding::objectToEntry(), com::sleepycat::bind::tuple::TupleTupleBinding::objectToKey(), com::sleepycat::bind::serial::TupleSerialBinding::objectToKey(), com::sleepycat::bind::tuple::ShortBinding::shortToEntry(), and com::sleepycat::bind::tuple::StringBinding::stringToEntry().

void com::sleepycat::bind::tuple::TupleBase::setTupleBufferSize int  byteSize  )  [inline]
 

Sets the initial byte size of the output buffer that is allocated by the default implementation of getTupleOutput.

If this property is zero (the default), the default com.sleepycat.util.FastOutputStream#DEFAULT_INIT_SIZE size is used.

Parameters:
byteSize the initial byte size of the output buffer, or zero to use the default size.

Definition at line 52 of file TupleBase.java.


The documentation for this class was generated from the following file:
Generated on Sun Dec 25 12:14:59 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2