Class JsonMarshaller

java.lang.Object
de.hsh.graja.util.marshal.AbstractMarshaller
de.hsh.graja.util.marshal.JsonMarshaller

public class JsonMarshaller extends AbstractMarshaller
This is a JSON object marshaller. This class relies on JAXB annotations in the serialized class.
  • Constructor Details

    • JsonMarshaller

      public JsonMarshaller(boolean failOnUnknownProperties)
    • JsonMarshaller

      public JsonMarshaller()
  • 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.
    • write

      public void write(Object o, OutputStream output) throws javax.xml.bind.JAXBException, IOException
      Write an object {code o} to stream 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.