|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openbp.common.io.xml.XMLDriver
public final class XMLDriver
The XML driver class implements a generic driver for XML serialzation/deserialization. It builds upon Castor XML/bean mapping support.
| Constructor Summary | |
|---|---|
XMLDriver(java.lang.ClassLoader loader)
Class loader constructor. |
|
| Method Summary | |
|---|---|
java.lang.Object |
deserializeFile(java.lang.Class cls,
java.lang.String fileName)
Deserializes an object of known type from an input file. |
java.lang.Object |
deserializeFile(java.lang.String fileName)
Deserializes an object of unknown type from an input file. |
java.lang.Object |
deserializeResource(java.lang.Class cls,
org.springframework.core.io.Resource resource)
Deserializes an object of known type from an input file. |
java.lang.Object |
deserializeResource(org.springframework.core.io.Resource resource)
Deserializes an object of unknown type from an input file. |
java.lang.Object |
deserializeStream(java.lang.Class cls,
java.io.InputStream in)
Deserializes an object of known type from an input stream. |
java.lang.String |
getEncoding()
Gets the encoding for XML I/O. |
static XMLDriver |
getInstance()
Gets the singleton instance of this class. |
java.lang.ClassLoader |
getLoader()
Gets the class loader to user. |
org.exolab.castor.mapping.Mapping |
getMapping()
Gets the the castor mapping table. |
boolean |
isPrettyPrint()
Gets the flag if output should be pretty-printed. |
void |
loadMapping(java.lang.Class cls)
Loads the XML mapping for the specified class. |
void |
loadMapping(java.io.File file)
Loads a mapping from a mapping file. |
boolean |
loadMappings(java.lang.Class[] classes)
Loads a set of XML mappings. |
boolean |
loadMappings(java.util.Iterator itClasses)
Loads a set of XML mappings. |
void |
serialize(java.lang.Object o,
org.w3c.dom.Node node)
Serializes an object into a DOM node. |
void |
serialize(java.lang.Object o,
java.io.OutputStream out)
Serializes an object to an output stream. |
void |
serialize(java.lang.Object o,
java.lang.String fileName)
Serializes an object to an output file. |
void |
serializeObject(java.lang.Object o,
java.io.ObjectOutputStream out)
Serializes an object to an object output stream. |
static void |
setDefaultClassLoader(java.lang.ClassLoader defaultClassLoaderArg)
Sets the default class loader for all instances. |
void |
setEncoding(java.lang.String encoding)
Sets the encoding for XML I/O. |
void |
setPrettyPrint(boolean prettyPrint)
Sets the flag if output should be pretty-printed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XMLDriver(java.lang.ClassLoader loader)
loader - Class loader to use for class access| Method Detail |
|---|
public static XMLDriver getInstance()
public static void setDefaultClassLoader(java.lang.ClassLoader defaultClassLoaderArg)
public java.lang.ClassLoader getLoader()
public void serializeObject(java.lang.Object o,
java.io.ObjectOutputStream out)
throws java.io.IOException
o - Object to serializeout - Object output stream to write to
java.io.IOException - On i/o or xml/marshalling error
public void serialize(java.lang.Object o,
java.lang.String fileName)
throws XMLDriverException
o - Object to serializefileName - Output file name
XMLDriverException - On i/o or xml/marshalling error
public void serialize(java.lang.Object o,
java.io.OutputStream out)
throws XMLDriverException
o - Object to serializeout - Output stream
XMLDriverException - On i/o or xml/marshalling error
public void serialize(java.lang.Object o,
org.w3c.dom.Node node)
throws XMLDriverException
o - Object to serializenode - The DOM node to marshal into
XMLDriverException - On xml/marshalling error
public java.lang.Object deserializeFile(java.lang.String fileName)
throws XMLDriverException
fileName - Input file name
XMLDriverException - On i/o or xml/marshalling error
public java.lang.Object deserializeFile(java.lang.Class cls,
java.lang.String fileName)
throws XMLDriverException
cls - Class of the object to deserializefileName - Input file name
XMLDriverException - On i/o or xml/marshalling error
public java.lang.Object deserializeResource(org.springframework.core.io.Resource resource)
throws XMLDriverException
resource - Resource to open
XMLDriverException - On i/o or xml/marshalling error
public java.lang.Object deserializeResource(java.lang.Class cls,
org.springframework.core.io.Resource resource)
throws XMLDriverException
cls - Class of the object to deserializeresource - Resource to open
XMLDriverException - On i/o or xml/marshalling error
public java.lang.Object deserializeStream(java.lang.Class cls,
java.io.InputStream in)
throws XMLDriverException
cls - Class of the object to deserializein - Input stream
XMLDriverException - On i/o or xml/marshalling errorpublic java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
public boolean isPrettyPrint()
public void setPrettyPrint(boolean prettyPrint)
public boolean loadMappings(java.util.Iterator itClasses)
itClasses - Iterator that contains the class objects (java.lang.Class) to load the mappings for
public boolean loadMappings(java.lang.Class[] classes)
classes - Classes to load the mappings for
public void loadMapping(java.lang.Class cls)
throws XMLDriverException
cls - Class to load the mapping for
XMLDriverException - If no mapping file exists for this class or if
the mapping file could not be loaded successfully
public void loadMapping(java.io.File file)
throws XMLDriverException
file - Mapping file to load
XMLDriverException - If no mapping file exists for this class or if
the mapping file could not be loaded successfullypublic org.exolab.castor.mapping.Mapping getMapping()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||