use of it.uniroma1.dis.wsngroup.gexf4j.core.impl.writer.GexfEntityWriter in project gexf4j by francesco-ficarola.
the class StaxGraphWriter method writeToStream.
@Override
public void writeToStream(Gexf gexf, Writer out, String encoding) throws IOException {
try {
XMLOutputFactory xmlOutputFactory = WstxOutputFactory.newInstance();
XMLStreamWriter streamWriter = xmlOutputFactory.createXMLStreamWriter(out);
PrettyPrintHandler handler = new PrettyPrintHandler(streamWriter);
streamWriter = (XMLStreamWriter) Proxy.newProxyInstance(XMLStreamWriter.class.getClassLoader(), new Class[] { XMLStreamWriter.class }, handler);
streamWriter.writeStartDocument(encoding, "1.0");
new GexfEntityWriter(streamWriter, gexf);
streamWriter.writeEndDocument();
streamWriter.flush();
streamWriter.close();
} catch (XMLStreamException e) {
throw new IOException("XML Exception: " + e.getMessage(), e);
}
}
Aggregations