|
Berkeley DB version 5.3.28 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sleepycat.bind.serial.SerialBase
public class SerialBase
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 setSerialBufferSize(int)
method may be used to control the initial size of the
buffer, and the getSerialOutput(java.lang.Object)
method may be overridden by
subclasses to take over creation of the FastOutputStream object.
Constructor Summary | |
---|---|
SerialBase()
Initializes the initial output buffer size to zero. |
Method Summary | |
---|---|
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. |
void |
setSerialBufferSize(int byteSize)
Sets the initial byte size of the output buffer that is allocated by the default implementation of getSerialOutput(java.lang.Object) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SerialBase()
Unless setSerialBufferSize(int)
is called, the default FastOutputStream.DEFAULT_INIT_SIZE
size will be used.
Method Detail |
---|
public void setSerialBufferSize(int byteSize)
getSerialOutput(java.lang.Object)
.
If this property is zero (the default), the default FastOutputStream.DEFAULT_INIT_SIZE
size is used.
byteSize
- the initial byte size of the output buffer, or zero to
use the default size.public int getSerialBufferSize()
setSerialBufferSize(int)
protected FastOutputStream getSerialOutput(Object object)
The default implementation of this method creates a new SerialOutput
with an initial buffer size that can be changed using the setSerialBufferSize(int)
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.
object
- is the object to be written to the serial output, and may
be used by subclasses to determine the size of the output buffer.
setSerialBufferSize(int)
|
Berkeley DB version 5.3.28 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |