com.sleepycat.bind.tuple
public class TupleBase extends Object
Tuple bindings and key creators append data to a TupleOutput instance, which is also a 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 method may be used to control the initial size of the buffer, and the TupleBase method may be overridden by subclasses to take over creation of the TupleOutput object.
Constructor Summary | |
---|---|
TupleBase()
Initializes the initial output buffer size to zero.
|
Method Summary | |
---|---|
static TupleInput | entryToInput(DatabaseEntry entry)
Utility method to create a new tuple input object for reading the data
from a given buffer. |
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.
|
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.
|
static TupleOutput | newOutput()
Utility method for use by bindings to create a tuple output object.
|
static TupleOutput | newOutput(byte[] buffer)
Utility method for use by bindings to create a tuple output object
with a specific starting size.
|
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.
|
void | setTupleBufferSize(int byteSize)
Sets the initial byte size of the output buffer that is allocated by the
default implementation of TupleBase.
|
Unless TupleBase is called, the default DEFAULT_INIT_SIZE size will be used.
Parameters: entry is the source entry buffer.
Returns: the new tuple input object.
Returns: the initial byte size of the output buffer.
See Also: TupleBase
The default implementation of this method creates a new TupleOutput with an initial buffer size that can be changed using the TupleBase 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 FastOutputStream 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: TupleBase
Parameters: input is the source tuple input object. entry is the destination entry buffer.
Deprecated: replaced by TupleBase
Utility method for use by bindings to create a tuple output object.Returns: a new tuple output object.
Deprecated: replaced by TupleBase
Utility method for use by bindings to create a tuple output object with a specific starting size.Returns: a new tuple output object.
Parameters: output is the source tuple output object. entry is the destination entry buffer.
If this property is zero (the default), the default DEFAULT_INIT_SIZE size is used.
Parameters: byteSize the initial byte size of the output buffer, or zero to use the default size.