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