de.netseeker.ejoe.adapter
Class XStreamAdapter

java.lang.Object
  extended by de.netseeker.ejoe.adapter.BaseAdapter
      extended by de.netseeker.ejoe.adapter.XStreamAdapter
All Implemented Interfaces:
SerializeAdapter, java.io.Serializable
Direct Known Subclasses:
XStreamJsonAdapter

public class XStreamAdapter
extends BaseAdapter

An adapter for (de)serializing objects via the great XStream library

Since:
0.3.0
Author:
netseeker aka Michael Manske
See Also:
Serialized Form

Field Summary
protected  com.thoughtworks.xstream.XStream _xstream
           
 
Constructor Summary
XStreamAdapter()
          Creates a new instance of XStreamAdapter using compact XML
XStreamAdapter(boolean isCompact)
          Creates a new instance of XStreamAdapter
XStreamAdapter(com.thoughtworks.xstream.io.HierarchicalStreamDriver driver)
          Creates a new instance of XStreamAdapter using the given HierarchicalStreamDriver
 
Method Summary
 java.lang.String getContentType()
           
 void handleClassLoaderChange(java.lang.ClassLoader classLoader)
          Signals a change of the ContextClassLoader of the current thread to the adapter.
 java.lang.Object read(java.io.InputStream in)
          Deserializes an object out of an given InputStream
 void write(java.lang.Object obj, java.io.OutputStream out)
          Serializes an object into an output stream
 
Methods inherited from class de.netseeker.ejoe.adapter.BaseAdapter
isSelfBuffered, requiresCustomEOFHandling
 
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

XStreamAdapter

public XStreamAdapter()
Creates a new instance of XStreamAdapter using compact XML


XStreamAdapter

public XStreamAdapter(boolean isCompact)
Creates a new instance of XStreamAdapter

Parameters:
isCompact - true if this Adapter should use compact xml otherwise false
See Also:
CompactWriter

XStreamAdapter

public XStreamAdapter(com.thoughtworks.xstream.io.HierarchicalStreamDriver driver)
Creates a new instance of XStreamAdapter using the given HierarchicalStreamDriver

Method Detail

read

public java.lang.Object read(java.io.InputStream in)
                      throws java.lang.Exception
Description copied from interface: SerializeAdapter
Deserializes an object out of an given InputStream

Parameters:
in - the input stream to use for deserialization
Returns:
a deserialized object instance
Throws:
java.lang.Exception

write

public void write(java.lang.Object obj,
                  java.io.OutputStream out)
           throws java.lang.Exception
Description copied from interface: SerializeAdapter
Serializes an object into an output stream

Parameters:
obj - object that should get serialized
out - the outputstream into which the object should serialized
Throws:
java.lang.Exception

handleClassLoaderChange

public void handleClassLoaderChange(java.lang.ClassLoader classLoader)
Description copied from interface: SerializeAdapter
Signals a change of the ContextClassLoader of the current thread to the adapter. This method will be called when the EJOE client is started with support for remote classloading.

Specified by:
handleClassLoaderChange in interface SerializeAdapter
Overrides:
handleClassLoaderChange in class BaseAdapter

getContentType

public java.lang.String getContentType()
Specified by:
getContentType in interface SerializeAdapter
Overrides:
getContentType in class BaseAdapter
Returns:
A recognized mime type
See Also:
mime type list of IANA


Copyright © 2005-2007 netseeker. All Rights Reserved.