Class AbstractExternalizer

  • All Implemented Interfaces:
    java.io.Serializable, Externalizer

    public abstract class AbstractExternalizer
    extends java.lang.Object
    implements Externalizer
    An externalizer base class which handles object creation in a default fashion.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long serialVersionUID  
    • Method Summary

      All Methods Instance Methods Concrete 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 using the provided creator.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractExternalizer

        public AbstractExternalizer()
    • Method Detail

      • createExternal

        public 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 using the provided creator.
        Specified by:
        createExternal in interface Externalizer
        Parameters:
        subjectType - the type to create
        input - the object input
        defaultCreator - the creator
        Returns:
        a new instance
        Throws:
        java.io.IOException - if an I/O error occurs
        java.lang.ClassNotFoundException - if the class could not be located
      • writeExternal

        public 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. This default implementation does nothing.
        Specified by:
        writeExternal in interface Externalizer
        Parameters:
        subject - the object to externalize
        output - the output
        Throws:
        java.io.IOException - if an error occurs
      • readExternal

        public 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. This default implementation does nothing.
        Specified by:
        readExternal in interface Externalizer
        Parameters:
        subject - the object to read
        input - the input
        Throws:
        java.io.IOException - if an error occurs
        java.lang.ClassNotFoundException - if a class could not be found during read