Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.thoughtworks.xstream
Class XStreamer

    java.lang.Object
      com.thoughtworks.xstream.XStreamer

    public class XStreamer

extends Object

Self-contained XStream generator. The class is a utility to write XML streams that contain additionally the XStream that was used to serialize the object graph. Such a stream can be unmarshalled using this embedded XStream instance, that kept any settings.

Since:
  1.2
Author:
  Jörg Schaible

Constructor Summary
`XStreamer()`

Method Summary
`Object` | `fromXML(HierarchicalStreamDriver driver, Reader xml)` Deserialize a self-contained XStream with object from an XML Reader.
`Object` | `fromXML(HierarchicalStreamDriver driver, String xml)` Deserialize a self-contained XStream with object from a String.
`Object` | `fromXML(Reader xml)` Deserialize a self-contained XStream with object from an XML Reader.
`Object` | `fromXML(String xml)` Deserialize a self-contained XStream with object from a String.
`String` | `toXML(XStream xstream, Object obj)` Serialize an object including the XStream to a pretty-printed XML String.
`void` | `toXML(XStream xstream, Object obj, Writer out)` Serialize an object including the XStream to the given Writer as pretty-printed XML.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XStreamer

    public XStreamer()

Method Detail

### toXML

    public String toXML(XStream xstream,
                        Object obj)
                 throws ObjectStreamException

  Serialize an object including the XStream to a pretty-printed XML String.

  Throws:
    `ObjectStreamException` - if the XML contains non-serializable elements
    `XStreamException` - if the object cannot be serialized
  Since:
    1.2
  See Also:
    `toXML(XStream, Object, Writer)`

### toXML

    public void toXML(XStream xstream,
                      Object obj,
                      Writer out)
               throws IOException

  Serialize an object including the XStream to the given Writer as pretty-printed XML.

  Warning: XStream will serialize itself into this XML stream. To read such an XML code, you should use `fromXML(Reader)` or one of the other overloaded methods. Since a lot of internals are written into the stream, you cannot expect to use such an XML to work with another XStream version or with XStream running on different JDKs and/or versions. We have currently no JDK 1.3 support, nor will the PureReflectionConverter work with a JDK less than 1.5.

  Throws:
    `IOException` - if an error occurs reading from the Writer.
    `XStreamException` - if the object cannot be serialized
  Since:
    1.2

### fromXML

    public Object fromXML(String xml)
                   throws ClassNotFoundException,
                          ObjectStreamException

  Deserialize a self-contained XStream with object from a String. The method will use internally an XppDriver to load the contained XStream instance.

  Throws:
    `ClassNotFoundException` - if a class in the XML stream cannot be found
    `ObjectStreamException` - if the XML contains non-deserializable elements
    `XStreamException` - if the object cannot be deserialized
  Since:
    1.2
  See Also:
    `toXML(XStream, Object, Writer)`

### fromXML

    public Object fromXML(HierarchicalStreamDriver driver,
                          String xml)
                   throws ClassNotFoundException,
                          ObjectStreamException

  Deserialize a self-contained XStream with object from a String.

  Throws:
    `ClassNotFoundException` - if a class in the XML stream cannot be found
    `ObjectStreamException` - if the XML contains non-deserializable elements
    `XStreamException` - if the object cannot be deserialized
  Since:
    1.2
  See Also:
    `toXML(XStream, Object, Writer)`

### fromXML

    public Object fromXML(Reader xml)
                   throws IOException,
                          ClassNotFoundException

  Deserialize a self-contained XStream with object from an XML Reader. The method will use internally an XppDriver to load the contained XStream instance.

  Throws:
    `IOException` - if an error occurs reading from the Reader.
    `ClassNotFoundException` - if a class in the XML stream cannot be found
    `XStreamException` - if the object cannot be deserialized
  Since:
    1.2
  See Also:
    `toXML(XStream, Object, Writer)`

### fromXML

    public Object fromXML(HierarchicalStreamDriver driver,
                          Reader xml)
                   throws IOException,
                          ClassNotFoundException

  Deserialize a self-contained XStream with object from an XML Reader.

  Throws:
    `IOException` - if an error occurs reading from the Reader.
    `ClassNotFoundException` - if a class in the XML stream cannot be found
    `XStreamException` - if the object cannot be deserialized
  Since:
    1.2

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2008 XStream. All Rights Reserved.