use of org.apache.jena.atlas.io.IndentedWriter in project jena by apache.
the class dumpnodes method dump.
public static void dump(OutputStream w, ObjectFile objFile) {
// Better to hack the indexes?
Iterator<Pair<NodeId, Node>> iter = all(objFile);
long count = 0;
try (IndentedWriter iw = new IndentedWriter(w)) {
if (!iter.hasNext()) {
iw.println("No nodes in the .dat file");
return;
}
for (; iter.hasNext(); ) {
Pair<NodeId, Node> pair = iter.next();
iw.print(pair.car().toString());
iw.print(" : ");
// iw.print(pair.cdr()) ;
Node n = pair.cdr();
String $ = stringForNode(n);
iw.print($);
iw.println();
count++;
}
iw.println();
iw.printf("Total: " + count);
iw.println();
iw.flush();
}
}
use of org.apache.jena.atlas.io.IndentedWriter in project jena by apache.
the class tdbreorder method print.
private static void print(BasicPattern bgp) {
IndentedWriter out = IndentedWriter.stdout;
PrefixMapping pmap = SSE.getPrefixMapWrite();
SerializationContext sCxt = SSE.sCxt(pmap);
boolean first = true;
for (Triple t : bgp) {
if (!first)
out.print("\n");
else
first = false;
// Adds (triple ...)
// SSE.write(buff.getIndentedWriter(), t) ;
out.print("(");
WriterNode.outputPlain(out, t, sCxt);
out.print(")");
}
out.flush();
}
Aggregations