|
Berkeley DB version 4.2.52 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sleepycat.bdb.bind.tuple.TupleBinding
An abstract tuple binding for tuple keys or values. This class takes care of
converting the data to/from TupleInput
and TupleOutput
objects. Its two abstract methods must be implemented by a concrete
subclass to convert between tuples and key or value objects.
For keys or values which are Java primitive classes (String, Integer,
etc) getPrimitiveBinding(java.lang.Class, com.sleepycat.bdb.bind.tuple.TupleFormat)
may be used to return a builtin tuple
binding. A custom tuple binding for these types is not needed.
Constructor Summary | |
TupleBinding(TupleFormat format)
Creates a tuple binding. |
Method Summary | |
Object |
dataToObject(DataBuffer data)
Converts a data buffer into an Object. |
abstract Object |
dataToObject(TupleInput input)
Constructs a key or value object from TupleInput data. |
DataFormat |
getDataFormat()
Returns the format used for the data of this binding. |
static TupleBinding |
getPrimitiveBinding(Class cls,
TupleFormat format)
Creates a tuple binding for a primitive Java class. |
void |
objectToData(Object object,
DataBuffer data)
Converts an Object into a data buffer. |
abstract void |
objectToData(Object object,
TupleOutput output)
Converts a key or value object to a tuple data. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TupleBinding(TupleFormat format)
format
- is the format of the new binding.Method Detail |
public Object dataToObject(DataBuffer data) throws IOException
DataBinding
dataToObject
in interface DataBinding
data
- is the source data buffer.
IOException
public void objectToData(Object object, DataBuffer data) throws IOException
DataBinding
objectToData
in interface DataBinding
object
- is the source Object.data
- is the destination data buffer.
IOException
public DataFormat getDataFormat()
DataBinding
getDataFormat
in interface DataBinding
public abstract Object dataToObject(TupleInput input) throws IOException
TupleInput
data.
input
- is the tuple key or value data.
IOException
public abstract void objectToData(Object object, TupleOutput output) throws IOException
object
- is the key or value object.output
- is the tuple data to which the key or value should be
written.
IOException
public static TupleBinding getPrimitiveBinding(Class cls, TupleFormat format)
String
Integer
cls
- is the primitive Java class.format
- is the tuple format for the new binding.
|
Berkeley DB version 4.2.52 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |