About XStream
XStream is a simple library to serialize objects to XML and back again.
Features
- Ease of use. A high level facade is supplied that simplifies common use cases.
- No mappings required. Most objects can be serialized without need for specifying mappings.
- Performance. Speed and low memory footprint are a crucial part of the design, making it suitable for large object graphs or systems with high message throughput.
- Clean XML. No information is duplicated that can be obtained via reflection. This results in XML that is easier to read for humans and more compact than native Java serialization.
- Requires no modifications to objects. Serializes internal fields, including private and final. Supports non-public and inner classes. Classes are not required to have default constructor.
- Full object graph support. Duplicate references encountered in the object-model will be maintained. Supports circular references.
- Integrates with other XML APIs. By implementing an interface, XStream can serialize directly to/from any tree structure (not just XML).
- Customizable conversion stategies. Strategies can be registered allowing customization of how particular types are represented as XML.
- Error messages. When an exception occurs due to malformed XML, detailed diagnostics are provided to help isolate and fix the problem.
Typical Uses
- Persistence
- Transport
- Configuration
Known Limitations
If using the Sun 1.4 JVM, XStream can recreate classes that do not have a default constructor. However, if using a different JVM, a default constructor is required.
Getting Started
Jan 15, 2005 XStream 1.1 released
- Improved support for serializing objects as per the Java Serialization Specification:
- Calls custom serialization methods, readObject(), writeObject(), readResolve() and writeReplace() in class, if defined.
- Supports ObjectInputStream.getFields() and ObjectOutputStream.putFields() in custom serialization.
- Provides implementations of ObjectInputStream and ObjectOutputStream, allowing drop in replacements for standard serialization, including support for streams of objects. [More...]
- Reads and writes directly to most XML Java APIs: DOM, DOM4J, JDOM, XOM, Electric XML, StAX, Trax (write only), SAX (write only). [More...]