com.googlecode.xremoting.core.xstream
Class XStreamSerializer

java.lang.Object
  extended by com.googlecode.xremoting.core.xstream.XStreamSerializer
All Implemented Interfaces:
Serializer

public class XStreamSerializer
extends Object
implements Serializer

Serializer which uses XStream as a serialization engine. So, basically, data is converted to XML during the serialization.

This is the default XRemoting serializer.

Author:
Roman Puchkovskiy

Field Summary
protected  com.thoughtworks.xstream.XStream xstream
           
 
Constructor Summary
XStreamSerializer()
           
 
Method Summary
protected  Reader createReader(InputStream is)
           
protected  Writer createWriter(OutputStream os)
           
protected  com.thoughtworks.xstream.XStream createXStream()
           
<T> T
deserialize(InputStream is)
          Deserializes an object an InputStream.
protected  String getDefaultCharset()
           
 void serialize(Object object, OutputStream os)
          Serializes an object to an OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xstream

protected com.thoughtworks.xstream.XStream xstream
Constructor Detail

XStreamSerializer

public XStreamSerializer()
Method Detail

createXStream

protected com.thoughtworks.xstream.XStream createXStream()

serialize

public void serialize(Object object,
                      OutputStream os)
               throws SerializationException,
                      IOException
Description copied from interface: Serializer
Serializes an object to an OutputStream.

Specified by:
serialize in interface Serializer
Parameters:
object - object to serialize
os - output stream to which to serialize
Throws:
SerializationException - if something specific to serializer happened during the serialization
IOException - if input/output error happened

deserialize

public <T> T deserialize(InputStream is)
              throws SerializationException,
                     IOException
Description copied from interface: Serializer
Deserializes an object an InputStream.

Specified by:
deserialize in interface Serializer
Type Parameters:
T - returned type
Parameters:
is - input stream from which to deserialize
Returns:
deserialized object
Throws:
SerializationException - if something specific to serializer happened during the serialization
IOException - if input/output error happened

createWriter

protected Writer createWriter(OutputStream os)
                       throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

createReader

protected Reader createReader(InputStream is)
                       throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

getDefaultCharset

protected String getDefaultCharset()


Copyright © 2013. All Rights Reserved.