public class XStreamer
extends java.lang.Object
Constructor and Description |
---|
XStreamer() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
fromXML(HierarchicalStreamDriver driver,
java.io.Reader xml)
Deserialize a self-contained XStream with object from an XML Reader.
|
java.lang.Object |
fromXML(HierarchicalStreamDriver driver,
java.io.Reader xml,
TypePermission[] permissions)
Deserialize a self-contained XStream with object from an XML Reader.
|
java.lang.Object |
fromXML(HierarchicalStreamDriver driver,
java.lang.String xml)
Deserialize a self-contained XStream with object from a String.
|
java.lang.Object |
fromXML(HierarchicalStreamDriver driver,
java.lang.String xml,
TypePermission[] permissions)
Deserialize a self-contained XStream with object from a String.
|
java.lang.Object |
fromXML(java.io.Reader xml)
Deserialize a self-contained XStream with object from an XML Reader.
|
java.lang.Object |
fromXML(java.io.Reader xml,
TypePermission[] permissions)
Deserialize a self-contained XStream with object from an XML Reader.
|
java.lang.Object |
fromXML(java.lang.String xml)
Deserialize a self-contained XStream with object from a String.
|
java.lang.Object |
fromXML(java.lang.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.
|
java.lang.String |
toXML(XStream xstream,
java.lang.Object obj)
Serialize an object including the XStream to a pretty-printed XML String.
|
void |
toXML(XStream xstream,
java.lang.Object obj,
java.io.Writer out)
Serialize an object including the XStream to the given Writer as pretty-printed XML.
|
public java.lang.String toXML(XStream xstream, java.lang.Object obj) throws java.io.ObjectStreamException
java.io.ObjectStreamException
- if the XML contains non-serializable elementsXStreamException
- if the object cannot be serializedtoXML(XStream, Object, Writer)
public void toXML(XStream xstream, java.lang.Object obj, java.io.Writer out) throws java.io.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.
java.io.IOException
- if an error occurs reading from the Writer.XStreamException
- if the object cannot be serializedpublic java.lang.Object fromXML(java.lang.String xml) throws java.lang.ClassNotFoundException, java.io.ObjectStreamException
xml
- the XML datajava.lang.ClassNotFoundException
- if a class in the XML stream cannot be foundjava.io.ObjectStreamException
- if the XML contains non-deserializable elementsXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public java.lang.Object fromXML(java.lang.String xml, TypePermission[] permissions) throws java.lang.ClassNotFoundException, java.io.ObjectStreamException
xml
- the XML datapermissions
- the permissions to use (ensure that they include the defaults)java.lang.ClassNotFoundException
- if a class in the XML stream cannot be foundjava.io.ObjectStreamException
- if the XML contains non-deserializable elementsXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public java.lang.Object fromXML(HierarchicalStreamDriver driver, java.lang.String xml) throws java.lang.ClassNotFoundException, java.io.ObjectStreamException
driver
- the implementation to usexml
- the XML datajava.lang.ClassNotFoundException
- if a class in the XML stream cannot be foundjava.io.ObjectStreamException
- if the XML contains non-deserializable elementsXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public java.lang.Object fromXML(HierarchicalStreamDriver driver, java.lang.String xml, TypePermission[] permissions) throws java.lang.ClassNotFoundException, java.io.ObjectStreamException
driver
- the implementation to usexml
- the XML datapermissions
- the permissions to use (ensure that they include the defaults)java.lang.ClassNotFoundException
- if a class in the XML stream cannot be foundjava.io.ObjectStreamException
- if the XML contains non-deserializable elementsXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public java.lang.Object fromXML(java.io.Reader xml) throws java.io.IOException, java.lang.ClassNotFoundException
xml
- the Reader
providing the XML datajava.io.IOException
- if an error occurs reading from the Reader.java.lang.ClassNotFoundException
- if a class in the XML stream cannot be foundXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public java.lang.Object fromXML(java.io.Reader xml, TypePermission[] permissions) throws java.io.IOException, java.lang.ClassNotFoundException
xml
- the Reader
providing the XML datapermissions
- the permissions to use (ensure that they include the defaults)java.io.IOException
- if an error occurs reading from the Reader.java.lang.ClassNotFoundException
- if a class in the XML stream cannot be foundXStreamException
- if the object cannot be deserializedtoXML(XStream, Object, Writer)
public java.lang.Object fromXML(HierarchicalStreamDriver driver, java.io.Reader xml) throws java.io.IOException, java.lang.ClassNotFoundException
driver
- the implementation to usexml
- the Reader
providing the XML datajava.io.IOException
- if an error occurs reading from the Reader.java.lang.ClassNotFoundException
- if a class in the XML stream cannot be foundXStreamException
- if the object cannot be deserializedpublic java.lang.Object fromXML(HierarchicalStreamDriver driver, java.io.Reader xml, TypePermission[] permissions) throws java.io.IOException, java.lang.ClassNotFoundException
driver
- the implementation to usexml
- the Reader
providing the XML datapermissions
- the permissions to use (ensure that they include the defaults)java.io.IOException
- if an error occurs reading from the Reader.java.lang.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–2024 XStream. All rights reserved.