|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.util.TypeTable
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.
QuickSerializable
,
QSException
,
Types
Nested Class Summary | |
---|---|
static class |
TypeTable.DuplicateTypeCode
An exception class thrown when a given type code is passed to register_type(java.lang.String) for the second time with a different Java
type than the original call. |
static class |
TypeTable.NoSuchTypeCode
An exception class thrown when a request to new_object(ostore.util.InputBuffer)
passes in an un-registered type code. |
static class |
TypeTable.NotQuickSerializable
An exception class thrown when the object named by the parameter name to register_type(java.lang.String) does not refer to a
class which implements QuickSerializable . |
Constructor Summary | |
---|---|
TypeTable()
|
Method Summary | |
---|---|
static QuickSerializable |
new_object(InputBuffer buffer)
Constructs a new object out of an InputBuffer. |
static QuickSerializable |
new_object(long type_code,
byte[] data,
int[] offset)
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. |
static void |
register_type(Class this_class)
|
static void |
register_type(String name)
Register a new type, so that new_object(ostore.util.InputBuffer) can be called
later. |
static Class |
type_code_to_class(long type_code)
|
static long |
type_code(QuickSerializable obj)
|
static long |
type_code(String class_name)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TypeTable()
Method Detail |
public static void register_type(String name) throws TypeTable.DuplicateTypeCode, ClassNotFoundException, NoSuchMethodException, TypeTable.NotQuickSerializable
new_object(ostore.util.InputBuffer)
can be called
later.
name
- the fully qualified name of the Java class being
registered
ClassNotFoundException
- if the given class name cannot be
resolved to any loadable class by
the JVM
NoSuchMethodException
- 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
TypeTable.DuplicateTypeCode
public static void register_type(Class this_class) throws TypeTable.DuplicateTypeCode, NoSuchMethodException, TypeTable.NotQuickSerializable
TypeTable.DuplicateTypeCode
NoSuchMethodException
TypeTable.NotQuickSerializable
public static QuickSerializable new_object(InputBuffer buffer) throws QSException
InputBuffer.nextObject
instead.
QSException
public static QuickSerializable new_object(long type_code, byte[] data, int[] offset) throws QSException
register_type(java.lang.String)
using the data in
the given byte array.
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.
QSException
- if the constructor for the given type throws
onepublic static long type_code(QuickSerializable obj)
public static long type_code(String class_name)
public static Class type_code_to_class(long type_code)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |