public void serialize(Document doc, OutputStream out) throws IOException {
        Writer writer = new OutputStreamWriter(out, encoding);
        write(doc, writer, 0);
        writer.flush();
    }
Serialize {@code doc} to {@code out}

@param doc the document to serialize.
@param out the stream to serialize to.
@throws IOException for various error conditions
jme3-plugins/src/xml/java/com/jme3/export/xml/DOMSerializer.java