Search in sources :

Example 1 with StringWriterI

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

the class EscapeStr method stringEsc.

/*
     * Escape characters in a string according to Turtle rules. 
     */
public static String stringEsc(String s) {
    AWriter w = new StringWriterI();
    stringEsc(w, s, Chars.CH_QUOTE2, true, CharSpace.UTF8);
    return w.toString();
}
Also used : StringWriterI(org.apache.jena.atlas.io.StringWriterI) AWriter(org.apache.jena.atlas.io.AWriter)

Example 2 with StringWriterI

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

the class TestNodeFmt method test.

public static void test(NodeFormatter nodeFormatter, Node n, String str) {
    StringWriterI sw = new StringWriterI();
    nodeFormatter.format(sw, n);
    String str2 = sw.toString();
    assertEquals(str, str2);
}
Also used : StringWriterI(org.apache.jena.atlas.io.StringWriterI)

Example 3 with StringWriterI

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

the class TestQuotedStringOutput method testSingleLine.

static void testSingleLine(QuotedStringOutput proc, String input, String expected) {
    StringWriterI w = new StringWriterI();
    proc.writeStr(w, input);
    String output = w.toString();
    expected = proc.getQuoteChar() + expected + proc.getQuoteChar();
    assertEquals(expected, output);
}
Also used : StringWriterI(org.apache.jena.atlas.io.StringWriterI)

Example 4 with StringWriterI

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

the class TestQuotedStringOutput method testMultiLine.

static void testMultiLine(QuotedStringOutput proc, String input, String expected) {
    StringWriterI w = new StringWriterI();
    proc.writeStrMultiLine(w, input);
    String output = w.toString();
    assertEquals(expected, output);
}
Also used : StringWriterI(org.apache.jena.atlas.io.StringWriterI)

Aggregations

StringWriterI (org.apache.jena.atlas.io.StringWriterI)4 AWriter (org.apache.jena.atlas.io.AWriter)1