gov.sandia.cognition.io.serialization
Class XStreamSerializationHandler

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<SerializedType>
              extended by gov.sandia.cognition.io.serialization.AbstractTextSerializationHandler<Serializable>
                  extended by gov.sandia.cognition.io.serialization.XStreamSerializationHandler
All Implemented Interfaces:
FileSerializationHandler<Serializable>, StreamSerializationHandler<Serializable>, TextSerializationHandler<Serializable>, CloneableSerializable, Serializable, Cloneable

public class XStreamSerializationHandler
extends AbstractTextSerializationHandler<Serializable>

A serialization

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

Field Summary
protected  com.thoughtworks.xstream.XStream xstream
          The configured XStream object to use.
 
Constructor Summary
XStreamSerializationHandler()
          Creates a new XStreamSerializationHandler using a default XStream object underneath.
XStreamSerializationHandler(com.thoughtworks.xstream.XStream xstream)
          Creates a new XStreamSerializationHandler with the given XStream configuration.
 
Method Summary
static XStreamSerializationHandler getDefault()
          Gets the default instance XStreamSerializationHandler.
 Object readObject(Reader reader)
          Reads an object from the given reader.
 void writeObject(Writer writer, Serializable object)
          Writes an object to the given writer.
 
Methods inherited from class gov.sandia.cognition.io.serialization.AbstractTextSerializationHandler
convertFromString, convertToString, readObject, writeObject
 
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.StreamSerializationHandler
convertFromBytes, convertToBytes
 
Methods inherited from interface gov.sandia.cognition.io.serialization.FileSerializationHandler
readFromFile, readFromFile, writeToFile, writeToFile
 

Field Detail

xstream

protected transient com.thoughtworks.xstream.XStream xstream
The configured XStream object to use.

Constructor Detail

XStreamSerializationHandler

public XStreamSerializationHandler()
Creates a new XStreamSerializationHandler using a default XStream object underneath.


XStreamSerializationHandler

public XStreamSerializationHandler(com.thoughtworks.xstream.XStream xstream)
Creates a new XStreamSerializationHandler with the given XStream configuration.

Parameters:
xstream - The XStream configuration to use. Cannot be null.
Method Detail

getDefault

public static XStreamSerializationHandler getDefault()
Gets the default instance XStreamSerializationHandler.

Returns:
The default instance.

writeObject

public void writeObject(Writer writer,
                        Serializable object)
                 throws IOException
Description copied from interface: TextSerializationHandler
Writes an object to the given writer.

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

readObject

public Object readObject(Reader reader)
                  throws IOException
Description copied from interface: TextSerializationHandler
Reads an object from the given reader.

Parameters:
reader - The reader to read an object from.
Returns:
The object read from the reader.
Throws:
IOException - If there is an i/o error.