Berkeley DB
version 4.2.52

com.sleepycat.bdb.bind
Class SimpleBuffer

java.lang.Object
  |
  +--com.sleepycat.bdb.bind.SimpleBuffer
All Implemented Interfaces:
DataBuffer

public class SimpleBuffer
extends Object
implements DataBuffer

A simple data buffer implementation that allows using bindings for arbitrary data outside the context of a database.


Constructor Summary
SimpleBuffer()
          Creates a simple buffer with null data, an offset of zero and a length of zero.
SimpleBuffer(byte[] data)
          Creates a simple buffer with the given data with an offset of zero and a length equal to the length of the data array.
SimpleBuffer(byte[] data, int offset, int length)
          Creates a simple buffer with the given data, offset and length.
 
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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBuffer

public SimpleBuffer()
Creates a simple buffer with null data, an offset of zero and a length of zero.


SimpleBuffer

public SimpleBuffer(byte[] data)
Creates a simple buffer with the given data with an offset of zero and a length equal to the length of the data array.

Parameters:
data - is the data array and must not be modified after this method is called.

SimpleBuffer

public SimpleBuffer(byte[] data,
                    int offset,
                    int length)
Creates a simple buffer with the given data, offset and length.

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.
Method Detail

setData

public void setData(byte[] data,
                    int offset,
                    int length)
Description copied from interface: DataBuffer
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.

Specified by:
setData in interface DataBuffer
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()
Description copied from interface: DataBuffer
Returns the byte array of the data buffer. This array is owned by the buffer object and should not be modified.

Specified by:
getDataBytes in interface DataBuffer
Returns:
the byte array of the data buffer.

getDataOffset

public int getDataOffset()
Description copied from interface: DataBuffer
Returns the byte offset of the data in the array.

Specified by:
getDataOffset in interface DataBuffer
Returns:
the byte offset of the data in the array.

getDataLength

public int getDataLength()
Description copied from interface: DataBuffer
Returns the byte length of the data in the array.

Specified by:
getDataLength in interface DataBuffer
Returns:
the byte length of the data in the array.

setDataFormation

public void setDataFormation(Object formation)
Description copied from interface: DataBuffer
Sets the formation associated with the data in this buffer.

Specified by:
setDataFormation in interface DataBuffer
Parameters:
formation - is Object to set.

getDataFormation

public Object getDataFormation()
Description copied from interface: DataBuffer
Returns the formation associated with the data in this buffer.

Specified by:
getDataFormation in interface DataBuffer
Returns:
formation Object.

clearDataFormation

public void clearDataFormation()
Description copied from interface: DataBuffer
Sets the formation associated with the data in this buffer to null.

Specified by:
clearDataFormation in interface DataBuffer

Berkeley DB
version 4.2.52

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