Search in sources :

Example 71 with TProtocol

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

the class ThriftConverter method getInputProtocol.

private static TProtocol getInputProtocol() {
    TProtocol protocol = inputProtocols.get();
    if (protocol != null)
        return protocol;
    protocol = new TCompactProtocol(getInputTransport());
    inputProtocols.set(protocol);
    return protocol;
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol)

Example 72 with TProtocol

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

the class ThriftConverter method toBytes.

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

Example 73 with TProtocol

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

the class ThriftConverter method fromBytes.

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

Example 74 with TProtocol

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

the class ThriftConverter method getOutputProtocol.

private static TProtocol getOutputProtocol() {
    TProtocol protocol = outputProtocols.get();
    if (protocol != null)
        return protocol;
    protocol = new TCompactProtocol(getOutputTransport());
    outputProtocols.set(protocol);
    return protocol;
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol)

Example 75 with TProtocol

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

the class ThriftConverter method toBytes.

public static byte[] toBytes(RDF_Term term) throws TException {
    ByteArrayOutputStream output = getOutputStream();
    output.reset();
    TProtocol protocol = getOutputProtocol();
    term.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