private static String string(Consumer<IndentedLineBuffer> action) { IndentedLineBuffer x = new IndentedLineBuffer() ; action.accept(x); return x.asString() ; }
@Override public String toString() { IndentedLineBuffer buff = new IndentedLineBuffer() ; output(buff) ; return buff.asString() ; }
/** JsonValue to a formatted, multiline string */ public static String toString(JsonValue jValue) { try ( IndentedLineBuffer b = new IndentedLineBuffer() ) { JSON.write(b, jValue); return b.asString() ; } }
@Override public String toString() { IndentedLineBuffer buff = new IndentedLineBuffer() ; dump(buff) ; return buff.asString() ; }
public String dumpToString() { IndentedLineBuffer buff = new IndentedLineBuffer() ; output(buff) ; return buff.asString() ; }
public static String fmtSPARQL(ExprList exprs) { IndentedLineBuffer buff = new IndentedLineBuffer() ; fmtSPARQL(buff, exprs) ; return buff.toString() ; }
/** JsonValue to a string with no newlines */ public static String toStringFlat(JsonValue jValue) { try ( IndentedLineBuffer b = new IndentedLineBuffer() ) { b.setFlatMode(true); JSON.write(b, jValue); return b.asString() ; } }
public static String asString(Template template) { SerializationContext cxt = new SerializationContext() ; IndentedLineBuffer b = new IndentedLineBuffer() ; FmtTemplate.format(b, cxt, template) ; return b.toString() ; }
private String formatForLog(Query query) { IndentedLineBuffer out = new IndentedLineBuffer() ; out.setFlatMode(true) ; query.serialize(out) ; return out.asString() ; }
public static String toString(PrintSerializable item, PrefixMapping pmap) { IndentedLineBuffer buff = new IndentedLineBuffer() ; SerializationContext sCxt = new SerializationContext(pmap) ; item.output(buff, sCxt) ; return buff.toString() ; }
private static void formatted(JsonBuilder obj, UpdateRequest updateRequest) { IndentedLineBuffer out = new IndentedLineBuffer() ; updateRequest.output(out) ; obj.key(jFormatted).value(out.asString()) ; } }
private static void formatted(JsonBuilder obj, Query query) { IndentedLineBuffer out = new IndentedLineBuffer() ; query.serialize(out) ; obj.key(jFormatted).value(out.asString()) ; }
public static String asString(Path path, Prologue prologue) { IndentedLineBuffer buff = new IndentedLineBuffer() ; WriterPathVisitor w = new WriterPathVisitor(buff, prologue) ; path.visit(w) ; w.out.flush(); return buff.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() ; }
public static void explain(String message, BasicPattern bgp, Context context) { if ( explaining(InfoLevel.ALL, logExec, context) ) { try (IndentedLineBuffer iBuff = new IndentedLineBuffer()) { if ( MultiLinesForPatterns ) iBuff.incIndent() ; formatTriples(iBuff, bgp) ; iBuff.flush() ; String str = iBuff.toString() ; _explain(logExec, message, str, false) ; } } }
@Override public String asSparqlExpr(SerializationContext sCxt) { IndentedLineBuffer x = new IndentedLineBuffer() ; x.append(getName()) ; x.append("(") ; if ( isDistinct ) x.append("DISTINCT ") ; if ( getExprList() != null ) ExprUtils.fmtSPARQL(x, getExprList(), sCxt) ; x.append(")") ; return x.asString() ; }
@Test public void test_version_print_01() { Version ver = new Version(); ver.addClass(ARQ.class); IndentedLineBuffer buffer = new IndentedLineBuffer(); ver.print(buffer); String info = buffer.asString(); Assert.assertNotNull(info); Assert.assertTrue(info.contains("ARQ")); }
@Test public void write07() { try (IndentedLineBuffer b = new IndentedLineBuffer()) { b.setLinePrefix("@."); b.println("ABCD") ; assertEquals("@.ABCD\n", b.asString()) ; } } }
@Test public void testFormatBGP_1() { IndentedLineBuffer b = new IndentedLineBuffer() ; BasicPattern bgp = SSE.parseBGP("(prefix ((zz: <"+aUri+">)) (bgp (zz:s zz:p zz:o)))") ; FmtUtils.formatPattern(b, bgp, getContext()) ; assertEquals("zz:s zz:p zz:o .", b.toString()) ; }
@Test public void write02() { try (IndentedLineBuffer b = new IndentedLineBuffer()) { b.incIndent() ; b.print("hell") ; b.print("o") ; b.decIndent() ; assertEquals(" hello", b.asString()) ; } }