de.innovationgate.utils
public abstract class XStreamUtils extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static com.thoughtworks.xstream.XStream |
XSTREAM_CLONING |
Constructor and Description |
---|
XStreamUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
clone(java.lang.Object obj)
Tries to clone an object by serializing and de-serializing it via XStream
In case of any error returns null to indicate an unclonable object.
|
static java.lang.Object |
loadUtf8FromFile(com.thoughtworks.xstream.XStream xstream,
java.io.File file)
Loads an object from a UTF-8 encoded file
|
static java.lang.Object |
loadUtf8FromFileObject(com.thoughtworks.xstream.XStream xstream,
org.apache.commons.vfs2.FileObject file)
Loads an object from a UTF-8 encoded VFS file object
|
static java.lang.Object |
loadUtf8FromInputStream(com.thoughtworks.xstream.XStream xstream,
java.io.InputStream in)
Loads an object from a UTF-8 encoded input stream
|
static java.lang.Object |
loadUtf8FromInputStream(com.thoughtworks.xstream.XStream xstream,
java.io.InputStream in,
boolean forceClose)
Loads an object from a UTF-8 encoded input stream
|
static void |
writeUtf8ToFile(java.lang.Object obj,
com.thoughtworks.xstream.XStream xstream,
java.io.File file)
Serializes an object to a UTF-8 encoded file
|
static void |
writeUtf8ToFileObject(java.lang.Object obj,
com.thoughtworks.xstream.XStream xstream,
org.apache.commons.vfs2.FileObject file)
Serializes an object to a UTF-8 encoded VFS file object
|
static void |
writeUtf8ToOutputStream(java.lang.Object obj,
com.thoughtworks.xstream.XStream xstream,
java.io.OutputStream out)
Serializes an object to a UTF-8 encoded output stream
|
public static void writeUtf8ToFile(java.lang.Object obj, com.thoughtworks.xstream.XStream xstream, java.io.File file) throws java.io.IOException
obj
- The object to writexstream
- The XStream instance to usefile
- The file to writejava.io.IOException
public static void writeUtf8ToFileObject(java.lang.Object obj, com.thoughtworks.xstream.XStream xstream, org.apache.commons.vfs2.FileObject file) throws java.io.IOException
obj
- The object to writexstream
- The XStream instance to usefile
- The file to writejava.io.IOException
public static void writeUtf8ToOutputStream(java.lang.Object obj, com.thoughtworks.xstream.XStream xstream, java.io.OutputStream out) throws java.io.IOException
obj
- The object to writexstream
- The XStream instance to useout
- The output stream to write tojava.io.IOException
public static java.lang.Object loadUtf8FromInputStream(com.thoughtworks.xstream.XStream xstream, java.io.InputStream in) throws java.io.IOException
xstream
- The XStream instance to usein
- The input stream to read fromjava.io.IOException
public static java.lang.Object loadUtf8FromInputStream(com.thoughtworks.xstream.XStream xstream, java.io.InputStream in, boolean forceClose) throws java.io.IOException
xstream
- The XStream instance to usein
- The input stream to read fromforceClose
- force close on the input streamjava.io.IOException
public static java.lang.Object loadUtf8FromFile(com.thoughtworks.xstream.XStream xstream, java.io.File file) throws java.io.IOException
xstream
- The XStream instance to usefile
- The file to read fromjava.io.IOException
public static java.lang.Object loadUtf8FromFileObject(com.thoughtworks.xstream.XStream xstream, org.apache.commons.vfs2.FileObject file) throws java.io.IOException
xstream
- The XStream instance to usefile
- The file to read fromjava.io.IOException
public static java.lang.Object clone(java.lang.Object obj)
obj
- The object to clone