Package org.jboss.marshalling
Class ChainingObjectTable
- java.lang.Object
-
- org.jboss.marshalling.ChainingObjectTable
-
- All Implemented Interfaces:
ObjectTable
public class ChainingObjectTable extends java.lang.Object implements ObjectTable
An object table that multiplexes up to 256 class tables. The protocol works by prepending the custom object table with an identifier byte.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.marshalling.ObjectTable
ObjectTable.Writer
-
-
Field Summary
Fields Modifier and Type Field Description private ObjectTable[]
readers
private java.util.List<Pair<ObjectTable,ObjectTable.Writer>>
writers
-
Constructor Summary
Constructors Constructor Description ChainingObjectTable(ObjectTable[] objectTables)
Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectTable.Writer
getObjectWriter(java.lang.Object obj)
Determine whether the given object reference is a valid predefined reference.private static Pair<ObjectTable,ObjectTable.Writer>
pair(ObjectTable objectTable, ObjectTable.Writer writer)
java.lang.Object
readObject(Unmarshaller unmarshaller)
Read an instance from the stream.
-
-
-
Field Detail
-
writers
private final java.util.List<Pair<ObjectTable,ObjectTable.Writer>> writers
-
readers
private final ObjectTable[] readers
-
-
Constructor Detail
-
ChainingObjectTable
public ChainingObjectTable(ObjectTable[] objectTables)
Construct a new instance. The given array may be sparse, but it may not be more than 256 elements in length. Object tables are checked in order of increasing array index.- Parameters:
objectTables
- the object tables to delegate to
-
-
Method Detail
-
pair
private static Pair<ObjectTable,ObjectTable.Writer> pair(ObjectTable objectTable, ObjectTable.Writer writer)
-
getObjectWriter
public ObjectTable.Writer getObjectWriter(java.lang.Object obj) throws java.io.IOException
Determine whether the given object reference is a valid predefined reference.- Specified by:
getObjectWriter
in interfaceObjectTable
- Parameters:
obj
- the candidate object- Returns:
- the object writer, or
null
to use the default mechanism - Throws:
java.io.IOException
- if an I/O error occurs
-
readObject
public java.lang.Object readObject(Unmarshaller unmarshaller) throws java.io.IOException, java.lang.ClassNotFoundException
Read an instance from the stream. The instance will have been written by theObjectTable.getObjectWriter(Object)
method'sWriter
instance, as defined above.- Specified by:
readObject
in interfaceObjectTable
- Parameters:
unmarshaller
- the unmarshaller to read from- Returns:
- the object instance
- Throws:
java.io.IOException
- if an I/O error occursjava.lang.ClassNotFoundException
- if a class could not be found
-
-