public class XStreamer extends Object
Constructor and Description |
---|
XStreamer() |
Modifier and Type | Method and Description |
---|---|
Object |
fromXML(HierarchicalStreamDriver driver,
Reader xml)
Deserialize a self-contained XStream with object from an XML Reader.
|
Object |
fromXML(HierarchicalStreamDriver driver,
Reader xml,
TypePermission[] permissions)
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(HierarchicalStreamDriver driver,
String xml,
TypePermission[] permissions)
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(Reader xml,
TypePermission[] permissions)
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.
|
Object |
fromXML(String xml,
TypePermission[] permissions)
Deserialize a self-contained XStream with object from a String.
|
static TypePermission[] |
getDefaultPermissions()
Retrieve the default permissions to unmarshal an XStream instance.
|
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.
|
public String toXML(XStream xstream, Object obj) throws ObjectStreamException
ObjectStreamException
- if the XML contains non-serializable elementsXStreamException
- if the object cannot be serializedtoXML(XStream, Object, Writer)
public void toXML(XStream xstream, Object obj, Writer out) throws IOException
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.
IOException
- if an error occurs reading from the Writer.XStreamException
- if the object cannot be serializedpublic Object fromXML(String xml) throws ClassNotFoundException, ObjectStreamException
xml
- the XML dataClassNotFoundException
- if a class in the XML stream cannot be foundObjectStreamException
- if the XML contains non-deserializable elementsXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public Object fromXML(String xml, TypePermission[] permissions) throws ClassNotFoundException, ObjectStreamException
xml
- the XML datapermissions
- the permissions to use (ensure that they include the defaults)ClassNotFoundException
- if a class in the XML stream cannot be foundObjectStreamException
- if the XML contains non-deserializable elementsXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public Object fromXML(HierarchicalStreamDriver driver, String xml) throws ClassNotFoundException, ObjectStreamException
driver
- the implementation to usexml
- the XML dataClassNotFoundException
- if a class in the XML stream cannot be foundObjectStreamException
- if the XML contains non-deserializable elementsXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public Object fromXML(HierarchicalStreamDriver driver, String xml, TypePermission[] permissions) throws ClassNotFoundException, ObjectStreamException
driver
- the implementation to usexml
- the XML datapermissions
- the permissions to use (ensure that they include the defaults)ClassNotFoundException
- if a class in the XML stream cannot be foundObjectStreamException
- if the XML contains non-deserializable elementsXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public Object fromXML(Reader xml) throws IOException, ClassNotFoundException
xml
- the Reader
providing the XML dataIOException
- if an error occurs reading from the Reader.ClassNotFoundException
- if a class in the XML stream cannot be foundXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public Object fromXML(Reader xml, TypePermission[] permissions) throws IOException, ClassNotFoundException
xml
- the Reader
providing the XML datapermissions
- the permissions to use (ensure that they include the defaults)IOException
- if an error occurs reading from the Reader.ClassNotFoundException
- if a class in the XML stream cannot be foundXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public Object fromXML(HierarchicalStreamDriver driver, Reader xml) throws IOException, ClassNotFoundException
driver
- the implementation to usexml
- the Reader
providing the XML dataIOException
- if an error occurs reading from the Reader.ClassNotFoundException
- if a class in the XML stream cannot be foundXStreamException
- if the object cannot be deserializedpublic Object fromXML(HierarchicalStreamDriver driver, Reader xml, TypePermission[] permissions) throws IOException, ClassNotFoundException
driver
- the implementation to usexml
- the Reader
providing the XML datapermissions
- the permissions to use (ensure that they include the defaults)IOException
- if an error occurs reading from the Reader.ClassNotFoundException
- if a class in the XML stream cannot be foundXStreamException
- if the object cannot be deserializedpublic static TypePermission[] getDefaultPermissions()
The returned list will only cover permissions for XStream's own types. If your custom converters or mappers keep references to other types, you will have to add permission for those types on your own.
Copyright © 2004–2017 XStream. All rights reserved.