ostore.util
Class TypeTable
java.lang.Object
|
+--ostore.util.TypeTable
- public class TypeTable
- extends Object
Allows for the creation of new QuickSerializable objects from their type
codes and a byte array. This class facilitates the de-serialization
process by providing what are, in effect, virtual constructors.
- Version:
- "$Id: TypeTable.java,v 1.42 2003/06/18 21:09:04 srhea Exp $"
- Author:
- Sean C. Rhea
- See Also:
QuickSerializable
,
QSException
,
Types
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TypeTable
public TypeTable()
register_type
public static void register_type(String name)
throws TypeTable.DuplicateTypeCode,
ClassNotFoundException,
NoSuchMethodException,
TypeTable.NotQuickSerializable
- Register a new type, so that
new_object(ostore.util.InputBuffer)
can be called
later.
- Parameters:
name
- the fully qualified name of the Java class being
registered- Throws:
ClassNotFoundException
- if the given class name cannot be
resolved to any loadable class by
the JVMNoSuchMethodException
- if the given class does not have
a contructor of the form
Foo (InputBuffer buffer)
or
Foo (InputBuffer buffer) throws QSException
TypeTable.NotQuickSerializable
- if the given class is not a
subtype of QuickSerializable
new_object
public static QuickSerializable new_object(InputBuffer buffer)
throws QSException
- Constructs a new object out of an InputBuffer. Should not be called
by user code. Call
InputBuffer.nextObject
instead.
new_object
public static QuickSerializable new_object(long type_code,
byte[] data,
int[] offset)
throws QSException
- Constructs a new object of the type associated with the given type
code through a call to
register_type(java.lang.String)
using the data in
the given byte array.
- Parameters:
type_code
- the type code of the class to constructdata
- an array of bytes containing an encoding of an
object of the given type (!= null)offset
- a single element array which on function entry
should contain the starting index into the
data
array to begin reading from, and
which on function exit will be incremented by the
number of bytes read.- Throws:
QSException
- if the constructor for the given type throws
one
type_code
public static long type_code(QuickSerializable obj)
type_code
public static long type_code(String class_name)
type_code_to_class
public static Class type_code_to_class(long type_code)