Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

com::sleepycat::bind::serial::SerialBinding Class Reference

Inheritance diagram for com::sleepycat::bind::serial::SerialBinding:

com::sleepycat::bind::serial::SerialBase com::sleepycat::bind::EntryBinding

Public Member Functions

 SerialBinding (ClassCatalog classCatalog, Class baseClass)
final Class getBaseClass ()
ClassLoader getClassLoader ()
Object entryToObject (DatabaseEntry entry)
void objectToEntry (Object object, DatabaseEntry entry)

Detailed Description

A concrete EntryBinding that treats a key or data entry as a serialized object.

This binding stores objects in serialized object format. The deserialized objects are returned by the binding, and their Class must implement the Serializable interface.

Author:
Mark Hayes

Definition at line 31 of file SerialBinding.java.


Constructor & Destructor Documentation

com::sleepycat::bind::serial::SerialBinding::SerialBinding ClassCatalog  classCatalog,
Class  baseClass
[inline]
 

Creates a serial binding.

Parameters:
classCatalog is the catalog to hold shared class information and for a database should be a StoredClassCatalog.
baseClass is the base class for serialized objects stored using this binding -- all objects using this binding must be an instance of this class.

Definition at line 46 of file SerialBinding.java.


Member Function Documentation

Object com::sleepycat::bind::serial::SerialBinding::entryToObject DatabaseEntry  entry  )  [inline]
 

Deserialize an object from an entry buffer. May only be called for data that was serialized using objectToEntry, since the fixed serialization header is assumed to not be included in the input data. SerialInput is used to deserialize the object.

Parameters:
entry is the input serialized entry.
Returns:
the output deserialized object.

Implements com::sleepycat::bind::EntryBinding.

Definition at line 97 of file SerialBinding.java.

References getClassLoader().

Referenced by com::sleepycat::bind::serial::TupleSerialBinding::entryToObject(), com::sleepycat::bind::serial::SerialSerialBinding::entryToObject(), and com::sleepycat::bind::serial::test::SerialBindingTest::testClassloaderOverride().

final Class com::sleepycat::bind::serial::SerialBinding::getBaseClass  )  [inline]
 

Returns the base class for this binding.

Returns:
the base class for this binding.

Definition at line 60 of file SerialBinding.java.

ClassLoader com::sleepycat::bind::serial::SerialBinding::getClassLoader  )  [inline]
 

Returns the class loader to be used during deserialization, or null if a default class loader should be used. The default implementation of this method returns null.

This method may be overriden to return a dynamically determined class loader. For example, Thread.currentThread().getContextClassLoader() could be called to use the context class loader for the curren thread. Or getBaseClass().getClassLoader() could be called to use the class loader for the base class, assuming that a base class has been specified.

If this method returns null, a default class loader will be used as determined by the java.io.ObjectInputStream.resolveClass method.

Definition at line 82 of file SerialBinding.java.

Referenced by entryToObject().

void com::sleepycat::bind::serial::SerialBinding::objectToEntry Object  object,
DatabaseEntry  entry
[inline]
 

Serialize an object into an entry buffer. The fixed serialization header is not included in the output data to save space, and therefore to deserialize the data the complementary entryToObject method must be used. SerialOutput is used to serialize the object.

Note that this method sets the DatabaseEntry offset property to a non-zero value and the size property to a value less than the length of the byte array.

Parameters:
object is the input deserialized object.
entry is the output serialized entry.
Exceptions:
IllegalArgumentException if the object is not an instance of the base class for this binding.

Implements com::sleepycat::bind::EntryBinding.

Definition at line 137 of file SerialBinding.java.

References com::sleepycat::util::FastOutputStream::getBufferBytes(), com::sleepycat::util::FastOutputStream::getBufferLength(), and com::sleepycat::bind::serial::SerialBase::getSerialOutput().

Referenced by com::sleepycat::bind::serial::TupleSerialBinding::objectToData(), com::sleepycat::bind::serial::SerialSerialBinding::objectToData(), com::sleepycat::bind::serial::SerialSerialBinding::objectToKey(), and com::sleepycat::bind::serial::test::SerialBindingTest::testClassloaderOverride().


The documentation for this class was generated from the following file:
Generated on Sun Dec 25 12:14:58 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2