use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class UpdateValidator 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);
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class TestIndentedWriter method write03.
@Test
public void write03() {
try (IndentedLineBuffer b = new IndentedLineBuffer()) {
b.incIndent();
b.printf("0x%04X", 1);
b.println();
b.print("XX");
b.decIndent();
assertEquals(" 0x0001\n XX", b.asString());
}
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class TestIndentedWriter method write07.
@Test
public void write07() {
try (IndentedLineBuffer b = new IndentedLineBuffer()) {
b.setLinePrefix("@.");
b.println("ABCD");
assertEquals("@.ABCD\n", b.asString());
}
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class TestIndentedWriter method write04.
@Test
public void write04() {
try (IndentedLineBuffer b = new IndentedLineBuffer()) {
b.setLineNumbers(true);
b.setNumberWidth(5);
b.println("ABCD");
b.print("XYZ");
assertEquals(" 1 ABCD\n 2 XYZ", b.asString());
}
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class TestIndentedWriter method write02.
@Test
public void write02() {
try (IndentedLineBuffer b = new IndentedLineBuffer()) {
b.incIndent();
b.print("hell");
b.print("o");
b.decIndent();
assertEquals(" hello", b.asString());
}
}
Aggregations