Package org.jboss.marshalling
Interface Externalizer
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractExternalizer
,Pair.Externalizer
A replacement serializer for an object class.
-
Method Summary
Modifier and TypeMethodDescriptioncreateExternal
(Class<?> subjectType, ObjectInput input, Creator defaultCreator) Create an instance of a type.void
readExternal
(Object subject, ObjectInput input) Read the external representation of an object.void
writeExternal
(Object subject, ObjectOutput output) Write the external representation of an object.
-
Method Details
-
writeExternal
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:
IOException
- if an error occurs
-
createExternal
Object createExternal(Class<?> subjectType, ObjectInput input, Creator defaultCreator) throws IOException, 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:
IOException
- if an error occursClassNotFoundException
- if a class could not be found during read
-
readExternal
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:
IOException
- if an error occursClassNotFoundException
- if a class could not be found during read
-