Package de.hsh.graja.util.marshal
Class XmlMarshaller
- java.lang.Object
-
- de.hsh.graja.util.marshal.AbstractMarshaller
-
- de.hsh.graja.util.marshal.XmlMarshaller
-
public class XmlMarshaller extends AbstractMarshaller
This is a XML object marshaller. This class relies on JAXB annotations in the serialized class.
-
-
Constructor Summary
Constructors Constructor Description XmlMarshaller()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
read(InputStream input, Class<T> clazz)
Read an object frominput
and instantiate it as an object of classclazz
.void
write(Object o, OutputStream output)
Write an object {code o} tooutput
.-
Methods inherited from class de.hsh.graja.util.marshal.AbstractMarshaller
create, isSupportedFormat, read, write
-
-
-
-
Method Detail
-
read
public <T> T read(InputStream input, Class<T> clazz) throws javax.xml.bind.JAXBException, IOException
Read an object frominput
and instantiate it as an object of classclazz
.- Specified by:
read
in 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
public void write(Object o, OutputStream output) throws javax.xml.bind.JAXBException, IOException
Write an object {code o} tooutput
.- Specified by:
write
in 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
-
-