コード例 #1
0
ファイル: JsonHelper.java プロジェクト: nimbis/platformlayer
  public void marshal(T object, boolean formatted, OutputStream outputStream)
      throws XMLStreamException, JAXBException, TransformerException, JSONException {
    Configuration writeConfig = new Configuration(xmlNamespaceToJsonPrefix);
    MappedXMLOutputFactory xof = new MappedXMLOutputFactory(writeConfig);

    XMLStreamWriter xmlStreamWriter = xof.createXMLStreamWriter(outputStream);

    JaxbHelper jaxbHelper = JaxbHelper.get(clazz);
    jaxbHelper.marshal(object, formatted, xmlStreamWriter);
  }
コード例 #2
0
ファイル: JsonHelper.java プロジェクト: nimbis/platformlayer
 public static XMLStreamWriter buildStreamWriter(Writer writer, Configuration configuration)
     throws XMLStreamException {
   MappedXMLOutputFactory xof = new MappedXMLOutputFactory(configuration);
   XMLStreamWriter xmlStreamWriter = xof.createXMLStreamWriter(writer);
   return xmlStreamWriter;
 }