Search in sources :

Example 1 with QuotedStringOutput

use of org.apache.jena.riot.out.quoted.QuotedStringOutput in project jena by apache.

the class NodeFormatterTTL_MultiLine method writeLexicalMultiLine.

/**
 * Output a string and run the Runnable at the same indentation level
 */
private void writeLexicalMultiLine(AWriter writer, String str, Runnable action) {
    QuotedStringOutput escapeProc = chooseEscapeProcessor(str);
    int indent = -1;
    IndentedWriter iw = null;
    if (writer instanceof IndentedWriter) {
        iw = (IndentedWriter) writer;
        iw.pad();
        indent = iw.getAbsoluteIndent();
        iw.setAbsoluteIndent(0);
    }
    escapeProc.writeStrMultiLine(writer, str);
    if (action != null)
        action.run();
    if (indent >= 0)
        iw.setAbsoluteIndent(indent);
}
Also used : IndentedWriter(org.apache.jena.atlas.io.IndentedWriter) QuotedStringOutput(org.apache.jena.riot.out.quoted.QuotedStringOutput)

Example 2 with QuotedStringOutput

use of org.apache.jena.riot.out.quoted.QuotedStringOutput in project jena by apache.

the class NodeFormatterTTL_MultiLine method writeLexicalSingleLine.

/**
 * Output a string and run the Runnable at the same indentation level
 */
private void writeLexicalSingleLine(AWriter writer, String str, Runnable action) {
    QuotedStringOutput proc = chooseEscapeProcessor(str);
    proc.writeStr(writer, str);
    if (action != null)
        action.run();
}
Also used : QuotedStringOutput(org.apache.jena.riot.out.quoted.QuotedStringOutput)

Aggregations

QuotedStringOutput (org.apache.jena.riot.out.quoted.QuotedStringOutput)2 IndentedWriter (org.apache.jena.atlas.io.IndentedWriter)1