Search in sources :

Example 26 with TProtocol

use of org.apache.thrift.protocol.TProtocol in project jena by apache.

the class STriple method writeObject.

private void writeObject(java.io.ObjectOutputStream out) throws IOException {
    TProtocol protocol = TRDF.protocol(out);
    RDF_Term tterm = new RDF_Term();
    SerializerRDF.write(protocol, tterm, triple.getSubject());
    SerializerRDF.write(protocol, tterm, triple.getPredicate());
    SerializerRDF.write(protocol, tterm, triple.getObject());
    TRDF.flush(protocol);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term)

Example 27 with TProtocol

use of org.apache.thrift.protocol.TProtocol in project jena by apache.

the class STriple method readObject.

private void readObject(java.io.ObjectInputStream in) throws IOException {
    TProtocol protocol = TRDF.protocol(in);
    RDF_Term tterm = new RDF_Term();
    Node s = SerializerRDF.read(protocol, tterm);
    Node p = SerializerRDF.read(protocol, tterm);
    Node o = SerializerRDF.read(protocol, tterm);
    triple = Triple.create(s, p, o);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) Node(org.apache.jena.graph.Node) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term)

Example 28 with TProtocol

use of org.apache.thrift.protocol.TProtocol in project jena by apache.

the class ThriftConverter method fromBytes.

public static void fromBytes(byte[] buffer, RDF_Quad quad) throws TException {
    TMemoryInputTransport transport = getInputTransport();
    transport.reset(buffer);
    TProtocol protocol = getInputProtocol();
    quad.read(protocol);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) TMemoryInputTransport(org.apache.thrift.transport.TMemoryInputTransport)

Example 29 with TProtocol

use of org.apache.thrift.protocol.TProtocol in project jena by apache.

the class ThriftConverter method fromBytes.

public static void fromBytes(byte[] buffer, RDF_Triple triple) throws TException {
    TMemoryInputTransport transport = getInputTransport();
    transport.reset(buffer);
    TProtocol protocol = getInputProtocol();
    triple.read(protocol);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) TMemoryInputTransport(org.apache.thrift.transport.TMemoryInputTransport)

Example 30 with TProtocol

use of org.apache.thrift.protocol.TProtocol in project jena by apache.

the class ThriftConverter method toBytes.

public static byte[] toBytes(RDF_Triple triple) throws TException {
    ByteArrayOutputStream output = getOutputStream();
    output.reset();
    TProtocol protocol = getOutputProtocol();
    triple.write(protocol);
    return output.toByteArray();
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Aggregations

TProtocol (org.apache.thrift.protocol.TProtocol)78 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)29 TTransport (org.apache.thrift.transport.TTransport)28 TSocket (org.apache.thrift.transport.TSocket)23 TException (org.apache.thrift.TException)22 TFramedTransport (org.apache.thrift.transport.TFramedTransport)17 IOException (java.io.IOException)15 TCompactProtocol (org.apache.thrift.protocol.TCompactProtocol)10 TIOStreamTransport (org.apache.thrift.transport.TIOStreamTransport)10 THttpClient (org.apache.thrift.transport.THttpClient)9 TTransportException (org.apache.thrift.transport.TTransportException)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 TJSONProtocol (org.apache.thrift.protocol.TJSONProtocol)7 RDF_Term (org.apache.jena.riot.thrift.wire.RDF_Term)6 InputStream (java.io.InputStream)5 ArrayList (java.util.ArrayList)5 TProcessor (org.apache.thrift.TProcessor)5 Hbase (org.apache.hadoop.hbase.thrift.generated.Hbase)4 TTransportFactory (org.apache.thrift.transport.TTransportFactory)4 OutputStream (java.io.OutputStream)3