Berkeley DB
version 4.2.52

com.sleepycat.bdb.bind
Interface DataBuffer

All Known Implementing Classes:
DataThang, SimpleBuffer

public interface DataBuffer

The interface used in bindings to access the data as a byte array.

Each data buffer may contain a formation Object that is associated with the data. The formation may be used by bindings to cache an internal representation of the data that is specific to the format but can be used by all bindings. The formation must be cleared whenever the data in the buffer is changed.


Method Summary
 void clearDataFormation()
          Sets the formation associated with the data in this buffer to null.
 byte[] getDataBytes()
          Returns the byte array of the data buffer.
 Object getDataFormation()
          Returns the formation associated with the data in this buffer.
 int getDataLength()
          Returns the byte length of the data in the array.
 int getDataOffset()
          Returns the byte offset of the data in the array.
 void setData(byte[] data, int offset, int length)
          Sets the data in this buffer to the given value.
 void setDataFormation(Object formation)
          Sets the formation associated with the data in this buffer.
 

Method Detail

setData

public void setData(byte[] data,
                    int offset,
                    int length)
Sets the data in this buffer to the given value. The byte array given will be owned by this buffer object after this method is called and must not be modified thereafter. This method must clear the data formation for this buffer.

Parameters:
data - is the data array and must not be modified after this method is called.
offset - is the byte offset of the data in the array.
length - is the byte length of the data in the array.

getDataBytes

public byte[] getDataBytes()
Returns the byte array of the data buffer. This array is owned by the buffer object and should not be modified.

Returns:
the byte array of the data buffer.

getDataOffset

public int getDataOffset()
Returns the byte offset of the data in the array.

Returns:
the byte offset of the data in the array.

getDataLength

public int getDataLength()
Returns the byte length of the data in the array.

Returns:
the byte length of the data in the array.

setDataFormation

public void setDataFormation(Object formation)
Sets the formation associated with the data in this buffer.

Parameters:
formation - is Object to set.

getDataFormation

public Object getDataFormation()
Returns the formation associated with the data in this buffer.

Returns:
formation Object.

clearDataFormation

public void clearDataFormation()
Sets the formation associated with the data in this buffer to null.


Berkeley DB
version 4.2.52

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.