Package org.jboss.marshalling
Interface Externalizer
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
AbstractExternalizer
,Pair.Externalizer
public interface Externalizer extends java.io.Serializable
A replacement serializer for an object class.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
createExternal(java.lang.Class<?> subjectType, java.io.ObjectInput input, Creator defaultCreator)
Create an instance of a type.void
readExternal(java.lang.Object subject, java.io.ObjectInput input)
Read the external representation of an object.void
writeExternal(java.lang.Object subject, java.io.ObjectOutput output)
Write the external representation of an object.
-
-
-
Method Detail
-
writeExternal
void writeExternal(java.lang.Object subject, java.io.ObjectOutput output) throws java.io.IOException
Write the external representation of an object. The object's class and the externalizer's class will already have been written.- Parameters:
subject
- the object to externalizeoutput
- the output- Throws:
java.io.IOException
- if an error occurs
-
createExternal
java.lang.Object createExternal(java.lang.Class<?> subjectType, java.io.ObjectInput input, Creator defaultCreator) throws java.io.IOException, java.lang.ClassNotFoundException
Create an instance of a type. The object may then be initialized frominput
, or that may be deferred to thereadExternal()
method. Instances may simply delegate the task to the givenCreator
. Note that this method is called only on the leaf class, so externalizers for non-final classes that initialize the instance from the stream need to be aware of this.- Parameters:
subjectType
- the type of object to createinput
- the inputdefaultCreator
- the configured creator- Returns:
- the new instance
- Throws:
java.io.IOException
- if an error occursjava.lang.ClassNotFoundException
- if a class could not be found during read
-
readExternal
void readExternal(java.lang.Object subject, java.io.ObjectInput input) throws java.io.IOException, java.lang.ClassNotFoundException
Read the external representation of an object. The object will already be instantiated, but may be uninitialized, when this method is called.- Parameters:
subject
- the object to readinput
- the input- Throws:
java.io.IOException
- if an error occursjava.lang.ClassNotFoundException
- if a class could not be found during read
-
-