gov.sandia.cognition.io.serialization
Class JavaDefaultBinarySerializationHandler

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.io.serialization.AbstractFileSerializationHandler<SerializedType>
          extended by gov.sandia.cognition.io.serialization.AbstractStreamSerializationHandler<Serializable>
              extended by gov.sandia.cognition.io.serialization.JavaDefaultBinarySerializationHandler
All Implemented Interfaces:
FileSerializationHandler<Serializable>, StreamSerializationHandler<Serializable>, CloneableSerializable, Serializable, Cloneable

public class JavaDefaultBinarySerializationHandler
extends AbstractStreamSerializationHandler<Serializable>

A serialization handler based on basic Java binary serialization.

Since:
3.0
Author:
Justin Basilico
See Also:
Serialized Form

Constructor Summary
JavaDefaultBinarySerializationHandler()
          Creates a new JavaDefaultBinarySerializationHandler.
 
Method Summary
static JavaDefaultBinarySerializationHandler getInstance()
          Gets a singleton instance of the class.
 Object readObject(InputStream stream)
          Reads an object from the given stream.
 void writeObject(OutputStream stream, Serializable object)
          Writes an object to a given output stream.
 
Methods inherited from class gov.sandia.cognition.io.serialization.AbstractStreamSerializationHandler
convertFromBytes, convertToBytes, readFromFile, writeToFile
 
Methods inherited from class gov.sandia.cognition.io.serialization.AbstractFileSerializationHandler
readFromFile, writeToFile
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.io.serialization.FileSerializationHandler
readFromFile, writeToFile
 

Constructor Detail

JavaDefaultBinarySerializationHandler

public JavaDefaultBinarySerializationHandler()
Creates a new JavaDefaultBinarySerializationHandler.

Method Detail

getInstance

public static JavaDefaultBinarySerializationHandler getInstance()
Gets a singleton instance of the class.

Returns:
A singleton instance.

writeObject

public void writeObject(OutputStream stream,
                        Serializable object)
                 throws IOException
Description copied from interface: StreamSerializationHandler
Writes an object to a given output stream.

Parameters:
stream - The stream to write the object to.
object - The object to write.
Throws:
IOException - If there is an i/o error.

readObject

public Object readObject(InputStream stream)
                  throws IOException,
                         ClassNotFoundException
Description copied from interface: StreamSerializationHandler
Reads an object from the given stream.

Parameters:
stream - The stream to read an object from.
Returns:
The object read from the stream.
Throws:
IOException - If there is an i/o error.
ClassNotFoundException - If a class cannot be found.