Package de.hsh.graja.util.marshal
Class XmlMarshaller
java.lang.Object
de.hsh.graja.util.marshal.AbstractMarshaller
de.hsh.graja.util.marshal.XmlMarshaller
This is a XML object marshaller.
This class relies on JAXB annotations in the serialized class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Tread(InputStream input, Class<T> clazz) Read an object frominputand instantiate it as an object of classclazz.voidwrite(Object o, OutputStream output) Write an object {code o} tooutput.Methods inherited from class de.hsh.graja.util.marshal.AbstractMarshaller
create, isSupportedFormat, read, write
-
Constructor Details
-
XmlMarshaller
public XmlMarshaller()
-
-
Method Details
-
read
public <T> T read(InputStream input, Class<T> clazz) throws javax.xml.bind.JAXBException, IOException Read an object frominputand instantiate it as an object of classclazz.- Specified by:
readin classAbstractMarshaller- Parameters:
input- input streamclazz- type of the new instance- Returns:
- the new instance
- Throws:
javax.xml.bind.JAXBException- if an error was encountered while preparing the Marshaller object or the JAXBContext or while reading the object.IOException- if an I/O specific error was encountered.XMLStreamException
-
write
Write an object {code o} tooutput.- Specified by:
writein classAbstractMarshaller- Parameters:
o- the object to be writtenoutput- the output stream- Throws:
javax.xml.bind.JAXBException- if an error was encountered while preparing the Marshaller object or the JAXBContext or while writing the object.IOException- if an I/O specific error was encountered.XMLStreamException- if an error was encountered while writing XML data
-