Search in sources :

Example 1 with RDF_StreamRow

use of org.apache.jena.riot.thrift.wire.RDF_StreamRow in project jena by apache.

the class BinRDF method apply.

/**
     * Send the contents of a RDF-encoded Thrift file to an "action" 
     * @param protocol TProtocol
     * @param action   Code to act on the row.
     */
public static void apply(TProtocol protocol, Consumer<RDF_StreamRow> action) {
    RDF_StreamRow row = new RDF_StreamRow();
    while (protocol.getTransport().isOpen()) {
        try {
            row.read(protocol);
        } catch (TTransportException e) {
            if (e.getType() == TTransportException.END_OF_FILE)
                break;
        } catch (TException ex) {
            TRDF.exception(ex);
        }
        action.accept(row);
        row.clear();
    }
}
Also used : TException(org.apache.thrift.TException) TTransportException(org.apache.thrift.transport.TTransportException) RDF_StreamRow(org.apache.jena.riot.thrift.wire.RDF_StreamRow)

Aggregations

RDF_StreamRow (org.apache.jena.riot.thrift.wire.RDF_StreamRow)1 TException (org.apache.thrift.TException)1 TTransportException (org.apache.thrift.transport.TTransportException)1