Search in sources :

Example 1 with IndentedLineBuffer

use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.

the class PathWriter method asString.

public static String asString(Path path, Prologue prologue) {
    IndentedLineBuffer buff = new IndentedLineBuffer();
    PathWriterWorker w = new PathWriterWorker(buff, prologue);
    path.visit(w);
    w.out.flush();
    return buff.asString();
}
Also used : IndentedLineBuffer(org.apache.jena.atlas.io.IndentedLineBuffer)

Example 2 with IndentedLineBuffer

use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.

the class TestUpdateWriter method test.

private void test(String updateString) {
    UpdateRequest update1 = UpdateFactory.create(updateString);
    IndentedLineBuffer w = new IndentedLineBuffer();
    UpdateWriter.output(update1, w);
    String s = w.asString();
    UpdateRequest update2 = UpdateFactory.create(s);
    assertTrue(update1.equalTo(update2));
}
Also used : UpdateRequest(org.apache.jena.update.UpdateRequest) IndentedLineBuffer(org.apache.jena.atlas.io.IndentedLineBuffer)

Example 3 with IndentedLineBuffer

use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.

the class QueryValidator method output.

private void output(ServletOutputStream outStream, Content content, boolean lineNumbers) throws IOException {
    startFixed(outStream);
    IndentedLineBuffer out = new IndentedLineBuffer(lineNumbers);
    content.print(out);
    out.flush();
    String x = htmlQuote(out.asString());
    byte[] b = x.getBytes("UTF-8");
    outStream.write(b);
    finishFixed(outStream);
}
Also used : IndentedLineBuffer(org.apache.jena.atlas.io.IndentedLineBuffer)

Example 4 with IndentedLineBuffer

use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.

the class StreamsPrint method printString.

public static <T extends Printable> String printString(Iterable<? extends T> struct, String sep) {
    IndentedLineBuffer b = new IndentedLineBuffer();
    apply(struct.iterator(), new ActionPrint<T>(b, sep));
    return b.asString();
}
Also used : IndentedLineBuffer(org.apache.jena.atlas.io.IndentedLineBuffer)

Example 5 with IndentedLineBuffer

use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.

the class Query method serialize.

/** Convert the query to a string */
public String serialize() {
    IndentedLineBuffer buff = new IndentedLineBuffer();
    serialize(buff);
    return buff.toString();
}
Also used : IndentedLineBuffer(org.apache.jena.atlas.io.IndentedLineBuffer)

Aggregations

IndentedLineBuffer (org.apache.jena.atlas.io.IndentedLineBuffer)63 Test (org.junit.Test)10 SerializationContext (org.apache.jena.sparql.serializer.SerializationContext)5 Expr (org.apache.jena.sparql.expr.Expr)3 WriterExpr (org.apache.jena.sparql.sse.writers.WriterExpr)3 BasicPattern (org.apache.jena.sparql.core.BasicPattern)2 QueryCheckException (org.apache.jena.sparql.core.QueryCheckException)2 SSEParseException (org.apache.jena.sparql.sse.SSEParseException)2 UpdateRequest (org.apache.jena.update.UpdateRequest)2 Version (org.apache.jena.atlas.lib.Version)1 DatasetRef (org.apache.jena.fuseki.server.DatasetRef)1 Node (org.apache.jena.graph.Node)1 Triple (org.apache.jena.graph.Triple)1 Query (org.apache.jena.query.Query)1 QueryException (org.apache.jena.query.QueryException)1 QueryParseException (org.apache.jena.query.QueryParseException)1 RDFNode (org.apache.jena.rdf.model.RDFNode)1 PrefixMapping (org.apache.jena.shared.PrefixMapping)1 Op (org.apache.jena.sparql.algebra.Op)1 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)1