|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.prevayler.foundation.serialization.XStreamSerializer
public class XStreamSerializer
Writes and reads objects using XML. This serializer can be used for snapshots, journals or both.
This implementation requires the XStream Java and XML language binding framework which provides for Java object XML serialization.
Note that XStream has some dependencies of its own. It requires the standard XML API's (xml-apis.jar from the Apache Xerces2-j project or j2sdk1.4+) and an XML implementation (again, provided by Xerces2 or j2sdk1.4+).
To make XStream up to 10x faster, add XPP3 to the classpath. XStream has the concept of a HierarchicalStreamDriver and the default implementation for XStream is the highly performant XppDriver. However, XStream will fall back to the DomDriver if XPP3 is not found in the classpath making the XPP3 library entirely optional... well, not quite. See XSTR-71. The current decision in that issue forces XPP3 to be a required runtime dependency when using XStream unless one specifically configures another driver, such as the DomDriver.
Constructor Summary | |
---|---|
XStreamSerializer()
Use the default character encoding for XML serialization. |
|
XStreamSerializer(String encoding)
Use the specified character encoding for XML serialization. |
Method Summary | |
---|---|
protected com.thoughtworks.xstream.XStream |
createXStream()
Create a new XStream instance. |
Object |
readObject(InputStream stream)
Read an object from a stream. |
void |
writeObject(OutputStream stream,
Object object)
Write an object to a stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XStreamSerializer()
public XStreamSerializer(String encoding)
Method Detail |
---|
public void writeObject(OutputStream stream, Object object) throws IOException
Serializer
writeObject
in interface Serializer
IOException
public Object readObject(InputStream stream) throws IOException, ClassNotFoundException
Serializer
readObject
in interface Serializer
IOException
ClassNotFoundException
protected com.thoughtworks.xstream.XStream createXStream()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |