|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dellroad.stuff.jibx.JiBXUtil
public final class JiBXUtil
Some simplified API methods for JiBX XML encoding/decoding.
| Field Summary | |
|---|---|
static String |
XML_ENCODING
|
| Method Summary | ||
|---|---|---|
static
|
readObject(Class<T> targetClass,
InputStream input)
Read in an object encoded as XML. |
|
static
|
readObject(Class<T> targetClass,
String bindingName,
InputStream input)
Read in an object encoded as XML. |
|
static
|
readObject(Class<T> targetClass,
String bindingName,
URL url)
Read in an object encoded as XML from an URL. |
|
static
|
readObject(Class<T> targetClass,
URL url)
Read in an object encoded as XML from an URL. |
|
static String |
toString(Object obj)
Encode the given instance as an XML document and return it as a String. |
|
static String |
toString(Object obj,
String bindingName)
Encode the given instance as an XML document and return it as a String. |
|
static void |
writeObject(Object obj,
String bindingName,
Writer writer)
Write out the given instance encoded as an XML document with "UTF-8" as the declared encoding. |
|
static
|
writeObject(T obj,
OutputStream output)
Write out the given instance encoded as a UTF-8 encoded XML document. |
|
static
|
writeObject(T obj,
String bindingName,
OutputStream output)
Write out the given instance encoded as a UTF-8 encoded XML document. |
|
static
|
writeObject(T obj,
Writer writer)
Write out the given instance encoded as an XML document with "UTF-8" as the declared encoding. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String XML_ENCODING
| Method Detail |
|---|
public static <T> T readObject(Class<T> targetClass,
InputStream input)
throws JiBXException,
IOException
This method runs within a new invocation of IdGenerator.run() to support object references
(see IdMapper).
The input is not closed by this method.
targetClass - target classinput - source for the XML document
JiBXException - if there is a JiBX parse error
IOException - if an error occurs reading from input
public static <T> T readObject(Class<T> targetClass,
String bindingName,
InputStream input)
throws JiBXException,
IOException
This method runs within a new invocation of IdGenerator.run() to support object references
(see IdMapper).
The input is not closed by this method.
targetClass - target classbindingName - binding name, or null to choose the only oneinput - source for the XML document
JiBXException - if there is a JiBX parse error
IOException - if an error occurs reading from input
public static <T> T readObject(Class<T> targetClass,
URL url)
throws JiBXException,
IOException
URL.
This method assumes there is exactly one binding for the given class.
This method runs within a new invocation of IdGenerator.run() to support object references
(see IdMapper).
targetClass - target classurl - source for the XML document
JiBXException - if there is a JiBX parse error
IOException - if an error occurs reading the referenced document
public static <T> T readObject(Class<T> targetClass,
String bindingName,
URL url)
throws JiBXException,
IOException
URL.
This method runs within a new invocation of IdGenerator.run() to support object references
(see IdMapper).
targetClass - target classurl - source for the XML documentbindingName - binding name, or null to choose the only one
JiBXException - if there is a JiBX parse error
IOException - if an error occurs reading the referenced document
public static <T> void writeObject(T obj,
OutputStream output)
throws JiBXException,
IOException
This method runs within a new invocation of IdGenerator.run() to support object references
(see IdMapper).
obj - object to writeoutput - output destination; will not be closed by this method
JiBXException - if there is a JiBX encoding error
IOException - if an error occurs writing to output
public static <T> void writeObject(T obj,
String bindingName,
OutputStream output)
throws JiBXException,
IOException
This method runs within a new invocation of IdGenerator.run() to support object references
(see IdMapper).
obj - object to writebindingName - binding name, or null to choose the only oneoutput - output destination; will not be closed by this method
JiBXException - if there is a JiBX encoding error
IOException - if an error occurs writing to output
public static <T> void writeObject(T obj,
Writer writer)
throws JiBXException,
IOException
This method runs within a new invocation of IdGenerator.run() to support object references
(see IdMapper).
obj - object to writewriter - output destination; will not be closed by this method
JiBXException
IOException
public static void writeObject(Object obj,
String bindingName,
Writer writer)
throws JiBXException,
IOException
This method runs within a new invocation of IdGenerator.run() to support object references
(see IdMapper).
obj - object to writebindingName - binding name, or null to choose the only onewriter - output destination; will not be closed by this method
JiBXException
IOException
public static String toString(Object obj)
throws JiBXException
String.
This method assumes there is exactly one binding for the given class.
This method runs within a new invocation of IdGenerator.run() to support object references
(see IdMapper).
obj - object to encode
JiBXException - if there is a JiBX encoding error
public static String toString(Object obj,
String bindingName)
throws JiBXException
String.
This method runs within a new invocation of IdGenerator.run() to support object references
(see IdMapper).
obj - object to encodebindingName - binding name, or null to choose the only one
JiBXException - if there is a JiBX encoding error
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||