JBoss Marshalling 1.3.0.CR9

org.jboss.marshalling
Class Pair.Externalizer

java.lang.Object
  extended by org.jboss.marshalling.Pair.Externalizer
All Implemented Interfaces:
Externalizable, Serializable, Externalizer
Enclosing class:
Pair<A,B>

public static final class Pair.Externalizer
extends Object
implements Externalizer, Externalizable

An externalizer for Pair instances.

See Also:
Serialized Form

Constructor Summary
Pair.Externalizer()
           
 
Method Summary
 Object createExternal(Class<?> subjectType, ObjectInput input, Creator defaultCreator)
          Create an instance of a type.
static Pair.Externalizer getInstance()
          Get the single instance.
 void readExternal(ObjectInput in)
          
 void readExternal(Object subject, ObjectInput input)
          Read the external representation of an object.
protected  Object readResolve()
          Resolve the object to the single externalizer instance.
 void writeExternal(Object subject, ObjectOutput output)
          Write the external representation of an object.
 void writeExternal(ObjectOutput out)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pair.Externalizer

public Pair.Externalizer()
Method Detail

getInstance

public static Pair.Externalizer getInstance()
Get the single instance. Though multiple instances can be created using the public constructor, only a single instance need be used in practice since this class maintains no internal state.

Returns:
the instance

writeExternal

public void writeExternal(Object subject,
                          ObjectOutput output)
                   throws IOException
Write the external representation of an object. The object's class and the externalizer's class will already have been written.

Specified by:
writeExternal in interface Externalizer
Parameters:
subject - the object to externalize
output - the output
Throws:
IOException - if an error occurs

createExternal

public Object createExternal(Class<?> subjectType,
                             ObjectInput input,
                             Creator defaultCreator)
                      throws IOException,
                             ClassNotFoundException
Create an instance of a type. The object may then be initialized from input, or that may be deferred to the readExternal() method. Instances may simply delegate the task to the given Creator. 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.

Specified by:
createExternal in interface Externalizer
Parameters:
subjectType - the type of object to create
input - the input
defaultCreator - the configured creator
Returns:
the new instance
Throws:
IOException - if an error occurs
ClassNotFoundException - if a class could not be found during read

readExternal

public void readExternal(Object subject,
                         ObjectInput input)
Read the external representation of an object. The object will already be instantiated, but may be uninitialized, when this method is called.

Specified by:
readExternal in interface Externalizer
Parameters:
subject - the object to read
input - the input

writeExternal

public void writeExternal(ObjectOutput out)

Specified by:
writeExternal in interface Externalizable

readExternal

public void readExternal(ObjectInput in)

Specified by:
readExternal in interface Externalizable

readResolve

protected Object readResolve()
Resolve the object to the single externalizer instance.

Returns:
the instance

JBoss Marshalling 1.3.0.CR9

Copyright © 2011 JBoss, a division of Red Hat, Inc.