| java.lang.Object com.sleepycat.bind.serial.SerialBase
All known Subclasses: com.sleepycat.bind.serial.SerialBinding,
SerialBase | public class SerialBase (Code) | | A base class for serial bindings creators that provides control over the
allocation of the output buffer.
Serial bindings append data to 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
SerialBase.setSerialBufferSize method may be used to control the initial size of the
buffer, and the
SerialBase.getSerialOutput method may be overridden by
subclasses to take over creation of the FastOutputStream object.
|
Constructor Summary | |
public | SerialBase() Initializes the initial output buffer size to zero. |
Method Summary | |
public int | getSerialBufferSize() Returns the initial byte size of the output buffer. | protected FastOutputStream | getSerialOutput(Object object) Returns an empty SerialOutput instance that will be used by the serial
binding or key creator.
The default implementation of this method creates a new SerialOutput
with an initial buffer size that can be changed using the
SerialBase.setSerialBufferSize method.
This method may be overridden to return a FastOutputStream instance.
For example, an instance per thread could be created and returned by
this method. | public void | setSerialBufferSize(int byteSize) Sets the initial byte size of the output buffer that is allocated by the
default implementation of
SerialBase.getSerialOutput . |
getSerialBufferSize | public int getSerialBufferSize()(Code) | | Returns the initial byte size of the output buffer.
the initial byte size of the output buffer. See Also: SerialBase.setSerialBufferSize |
getSerialOutput | protected FastOutputStream getSerialOutput(Object object)(Code) | | Returns an empty SerialOutput instance that will be used by the serial
binding or key creator.
The default implementation of this method creates a new SerialOutput
with an initial buffer size that can be changed using the
SerialBase.setSerialBufferSize method.
This method may be overridden to return a FastOutputStream instance.
For example, an instance per thread could be created and returned by
this method. If a FastOutputStream instance is reused, be sure to call
its
FastOutputStream.reset method before each use.
Parameters: object - is the object to be written to the serial output, and maybe used by subclasses to determine the size of the output buffer. an empty FastOutputStream instance. See Also: SerialBase.setSerialBufferSize |
setSerialBufferSize | public void setSerialBufferSize(int byteSize)(Code) | | Sets the initial byte size of the output buffer that is allocated by the
default implementation of
SerialBase.getSerialOutput .
If this property is zero (the default), the default
FastOutputStream.DEFAULT_INIT_SIZE size is used.
Parameters: byteSize - the initial byte size of the output buffer, or zero touse the default size. |
|
|