Class SerializerHelper
- java.lang.Object
-
- org.pentaho.reporting.libraries.serializer.SerializerHelper
-
public class SerializerHelper extends java.lang.ObjectThe 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.- Author:
- Thomas Morgner
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SerializerHelpergetInstance()Returns or creates a new SerializerHelper.booleanisSerializable(java.lang.Object o)java.lang.ObjectreadObject(java.io.ObjectInputStream in)Reads the object from the object input stream.voidregisterMethod(SerializeMethod method)Registers a new SerializeMethod with this SerializerHelper.voidunregisterMethod(SerializeMethod method)Deregisters a new SerializeMethod with this SerializerHelper.voidwriteObject(java.lang.Object o, java.io.ObjectOutputStream out)Writes a serializable object description to the given object output stream.
-
-
-
Method Detail
-
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.- Returns:
- the SerializerHelper singleton instance.
-
registerMethod
public void registerMethod(SerializeMethod method)
Registers a new SerializeMethod with this SerializerHelper.- Parameters:
method- the method that should be registered.
-
unregisterMethod
public void unregisterMethod(SerializeMethod method)
Deregisters a new SerializeMethod with this SerializerHelper.- Parameters:
method- the method that should be deregistered.
-
writeObject
public void writeObject(java.lang.Object o, java.io.ObjectOutputStream out) throws java.io.IOExceptionWrites a serializable object description to the given object output stream. This method selects the best serialize helper method for the given object.- Parameters:
o- the to be serialized object.out- the outputstream that should receive the object.- Throws:
java.io.IOException- if an I/O error occured.
-
isSerializable
public boolean isSerializable(java.lang.Object o)
-
readObject
public java.lang.Object readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads 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.- Parameters:
in- the object input stream from where to read the serialized data.- Returns:
- the generated object.
- Throws:
java.io.IOException- if reading the stream failed.java.lang.ClassNotFoundException- if serialized object class cannot be found.
-
-