Search in sources :

Example 31 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 32 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 33 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 34 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)

Example 35 with TProtocol

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

the class TRDF method protocol.

/**
     * Create Thrift protocol for the InputStream.
     * @param in InputStream
     */
public static TProtocol protocol(InputStream in) {
    try {
        if (!(in instanceof BufferedInputStream))
            in = new BufferedInputStream(in, InputBufferSize);
        TTransport transport = new TIOStreamTransport(in);
        transport.open();
        TProtocol protocol = protocol(transport);
        return protocol;
    } catch (TException ex) {
        TRDF.exception(ex);
        return null;
    }
}
Also used : TException(org.apache.thrift.TException) BufferedInputStream(java.io.BufferedInputStream) TProtocol(org.apache.thrift.protocol.TProtocol) TIOStreamTransport(org.apache.thrift.transport.TIOStreamTransport) TTransport(org.apache.thrift.transport.TTransport)

Aggregations

TProtocol (org.apache.thrift.protocol.TProtocol)93 TTransport (org.apache.thrift.transport.TTransport)42 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)36 TSocket (org.apache.thrift.transport.TSocket)36 TException (org.apache.thrift.TException)25 TFramedTransport (org.apache.thrift.transport.TFramedTransport)24 TCompactProtocol (org.apache.thrift.protocol.TCompactProtocol)18 IOException (java.io.IOException)16 TIOStreamTransport (org.apache.thrift.transport.TIOStreamTransport)10 THttpClient (org.apache.thrift.transport.THttpClient)9 ArrayList (java.util.ArrayList)8 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 TProcessor (org.apache.thrift.TProcessor)6 InputStream (java.io.InputStream)5 TTransportFactory (org.apache.thrift.transport.TTransportFactory)5 ImageDatasetService (org.vcell.imagedataset.ImageDatasetService)5 Hbase (org.apache.hadoop.hbase.thrift.generated.Hbase)4