Java Code Examples for org.apache.jena.atlas.lib.StrUtils#fromUTF8bytes()

The following examples show how to use org.apache.jena.atlas.lib.StrUtils#fromUTF8bytes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestRDFChangesGraph.java    From rdf-delta with Apache License 2.0 6 votes vote down vote up
private Graph replay() {
    IO.close(bout);
    final boolean DEBUG = false;

    if ( DEBUG ) {
        System.out.println("== Graph ==");
        RDFDataMgr.write(System.out, baseGraph, Lang.NQ);
        System.out.println("== Replay ==");
        String x = StrUtils.fromUTF8bytes(bout.toByteArray());
        System.out.print(x);
        System.out.println("== ==");
    }

    // A completely separate graph (different dataset)
    Graph graph2 = txnGraph();

    try(ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray())) {
        RDFPatchOps.applyChange(graph2, bin);
        if ( DEBUG ) {
            System.out.println("== Graph outcome ==");
            RDFDataMgr.write(System.out, graph2, Lang.NT);
            System.out.println("== ==");
        }
        return graph2;
    } catch (IOException ex) { IO.exception(ex); return null; }
}
 
Example 2
Source File: TestRDFChanges.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
@Test public void changes_write_read_05() {
    byte[] output = write(changes->{
        changes.txnBegin();
        changes.txnCommit();
    });
    assertNotEquals(0, output.length);
    String x = StrUtils.fromUTF8bytes(output);
    assertEquals("TX .\nTC .\n", x);
}
 
Example 3
Source File: Zk.java    From rdf-delta with Apache License 2.0 4 votes vote down vote up
public static String zkFetchStr(CuratorFramework client, String path) {
    byte[] x = zkFetch(client, path);
    if ( x == null )
        return null;
    return StrUtils.fromUTF8bytes(x);
}
 
Example 4
Source File: TestRDFChanges.java    From rdf-delta with Apache License 2.0 4 votes vote down vote up
@Test public void changes_write_read_04() {
    byte[] output = write(changes->{});
    assertEquals(0, output.length);
    String x = StrUtils.fromUTF8bytes(output);
}