Search in sources :

Example 1 with PropertyListWriter

use of de.huxhorn.sulky.plist.impl.PropertyListWriter in project sulky by huxi.

the class PropertyListEncoder method encode.

public void encode(PropertyList obj, OutputStream into) throws IOException {
    PropertyListWriter propertyListWriter = new PropertyListWriter();
    XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
    try {
        XMLStreamWriter writer = outputFactory.createXMLStreamWriter(new OutputStreamWriter(into, StandardCharsets.UTF_8));
        propertyListWriter.write(writer, obj, true);
        writer.close();
    } catch (XMLStreamException e) {
        throw new IOException("Exception while writing XML!", e);
    }
}
Also used : XMLOutputFactory(javax.xml.stream.XMLOutputFactory) XMLStreamException(javax.xml.stream.XMLStreamException) PropertyListWriter(de.huxhorn.sulky.plist.impl.PropertyListWriter) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) OutputStreamWriter(java.io.OutputStreamWriter) IOException(java.io.IOException)

Aggregations

PropertyListWriter (de.huxhorn.sulky.plist.impl.PropertyListWriter)1 IOException (java.io.IOException)1 OutputStreamWriter (java.io.OutputStreamWriter)1 XMLOutputFactory (javax.xml.stream.XMLOutputFactory)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)1