Search in sources :

Example 1 with GexfWriter

use of it.uniroma1.dis.wsngroup.gexf4j.core.GexfWriter in project gridss by PapenfussLab.

the class GexfHelper method saveTo.

public static void saveTo(Gexf graph, File file) {
    file.getAbsoluteFile().getParentFile().mkdir();
    GexfWriter graphWriter = new StaxGraphWriter();
    Writer out = null;
    try {
        out = new FileWriter(file, false);
        graphWriter.writeToStream(graph, out, "UTF-8");
    } catch (IOException e) {
        log.error(String.format("Error writing graph visualisation to %s", file), e);
    } finally {
        CloserUtil.close(out);
        CloserUtil.close(graphWriter);
    }
}
Also used : FileWriter(java.io.FileWriter) GexfWriter(it.uniroma1.dis.wsngroup.gexf4j.core.GexfWriter) IOException(java.io.IOException) StaxGraphWriter(it.uniroma1.dis.wsngroup.gexf4j.core.impl.StaxGraphWriter) FileWriter(java.io.FileWriter) GexfWriter(it.uniroma1.dis.wsngroup.gexf4j.core.GexfWriter) Writer(java.io.Writer) StaxGraphWriter(it.uniroma1.dis.wsngroup.gexf4j.core.impl.StaxGraphWriter)

Aggregations

GexfWriter (it.uniroma1.dis.wsngroup.gexf4j.core.GexfWriter)1 StaxGraphWriter (it.uniroma1.dis.wsngroup.gexf4j.core.impl.StaxGraphWriter)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 Writer (java.io.Writer)1