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 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 from input and instantiate it as an object of class clazz.
      Specified by:
      read in class AbstractMarshaller
      Parameters:
      input - input stream
      clazz - 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} to output.
      Specified by:
      write in class AbstractMarshaller
      Parameters:
      o - the object to be written
      output - 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