org.jfree.serializer
Class SerializerHelper
java.lang.Object
org.jfree.serializer.SerializerHelper
The SerializeHelper is used to make implementing custom serialization
handlers easier. Handlers for certain object types need to be added to this
helper before this implementation is usable.
getComparator
protected ClassComparator getComparator()
Returns the class comparator instance used to find correct super classes.
getInstance
public static SerializerHelper getInstance()
Returns or creates a new SerializerHelper. When a new instance is created
by this method, all known SerializeMethods are registered.
- the SerializerHelper singleton instance.
getMethods
protected HashMap getMethods()
Returns the collection of all registered serialize methods.
- a collection of the registered serialize methods.
getSerializer
protected SerializeMethod getSerializer(Class c)
Looks up the SerializeMethod for the given class or null if there is no
SerializeMethod for the given class.
c
- the class for which we want to lookup a serialize method.
- the method or null, if there is no registered method for the
class.
getSuperClassObjectDescription
protected SerializeMethod getSuperClassObjectDescription(Class d)
Looks up the SerializeMethod for the given class or null if there is no
SerializeMethod for the given class. This method searches all
superclasses.
d
- the class for which we want to lookup a serialize
method.
- the method or null, if there is no registered method for the
class.
readObject
public Object readObject(ObjectInputStream in)
throws IOException,
ClassNotFoundException
Reads the object from the object input stream. This object selects the best
serializer to read the object.
Make sure, that you use the same configuration (library and class versions,
registered methods in the SerializerHelper) for reading as you used for
writing.
in
- the object input stream from where to read the serialized data.
registerMethod
public void registerMethod(SerializeMethod method)
Registers a new SerializeMethod with this SerializerHelper.
method
- the method that should be registered.
setInstance
protected static void setInstance(SerializerHelper helper)
This method can be used to replace the singleton instance of this helper.
helper
- the new instance of the serialize helper.
unregisterMethod
public void unregisterMethod(SerializeMethod method)
Deregisters a new SerializeMethod with this SerializerHelper.
method
- the method that should be deregistered.
writeObject
public void writeObject(Object o,
ObjectOutputStream out)
throws IOException
Writes a serializable object description to the given object output stream.
This method selects the best serialize helper method for the given object.
o
- the to be serialized object.out
- the outputstream that should receive the object.