Search in sources :

Example 31 with TCompactProtocol

use of org.apache.thrift.protocol.TCompactProtocol 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 32 with TCompactProtocol

use of org.apache.thrift.protocol.TCompactProtocol 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 33 with TCompactProtocol

use of org.apache.thrift.protocol.TCompactProtocol in project carbondata by apache.

the class CarbonUtil method read.

/**
 * Below method will be used to convert the byte array value to thrift object for
 * data chunk
 *
 * @param data    thrift byte array
 * @param creator type of thrift
 * @return thrift object
 * @throws IOException any problem while converting the object
 */
private static TBase read(byte[] data, TBaseCreator creator, int offset, int length) throws IOException {
    ByteArrayInputStream stream = new ByteArrayInputStream(data, offset, length);
    TProtocol binaryIn = new TCompactProtocol(new TIOStreamTransport(stream));
    TBase t = creator.create();
    try {
        t.read(binaryIn);
    } catch (TException e) {
        throw new IOException(e);
    } finally {
        CarbonUtil.closeStreams(stream);
    }
    return t;
}
Also used : TException(org.apache.thrift.TException) TProtocol(org.apache.thrift.protocol.TProtocol) TIOStreamTransport(org.apache.thrift.transport.TIOStreamTransport) TBase(org.apache.thrift.TBase) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol)

Example 34 with TCompactProtocol

use of org.apache.thrift.protocol.TCompactProtocol in project carbondata by apache.

the class ThriftReader method open.

/**
 * Opens the fileName for reading.
 */
public void open() throws IOException {
    FileFactory.FileType fileType = FileFactory.getFileType(fileName);
    dataInputStream = FileFactory.getDataInputStream(fileName, fileType, bufferSize);
    binaryIn = new TCompactProtocol(new TIOStreamTransport(dataInputStream));
}
Also used : TIOStreamTransport(org.apache.thrift.transport.TIOStreamTransport) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol) FileFactory(org.apache.carbondata.core.datastore.impl.FileFactory)

Example 35 with TCompactProtocol

use of org.apache.thrift.protocol.TCompactProtocol in project accumulo by apache.

the class TraceFormatter method getRemoteSpan.

public static RemoteSpan getRemoteSpan(Entry<Key, Value> entry) {
    TMemoryInputTransport transport = new TMemoryInputTransport(entry.getValue().get());
    TCompactProtocol protocol = new TCompactProtocol(transport);
    RemoteSpan span = new RemoteSpan();
    try {
        span.read(protocol);
    } catch (TException ex) {
        throw new RuntimeException(ex);
    }
    return span;
}
Also used : TException(org.apache.thrift.TException) RemoteSpan(org.apache.accumulo.tracer.thrift.RemoteSpan) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol) TMemoryInputTransport(org.apache.thrift.transport.TMemoryInputTransport)

Aggregations

TCompactProtocol (org.apache.thrift.protocol.TCompactProtocol)54 TProtocol (org.apache.thrift.protocol.TProtocol)38 THttpClient (org.apache.thrift.transport.THttpClient)18 TSocket (org.apache.thrift.transport.TSocket)18 TException (org.apache.thrift.TException)15 TTransport (org.apache.thrift.transport.TTransport)11 TFramedTransport (org.apache.thrift.transport.TFramedTransport)9 IOException (java.io.IOException)8 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)7 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)7 TIOStreamTransport (org.apache.thrift.transport.TIOStreamTransport)7 TTransportException (org.apache.thrift.transport.TTransportException)5 TFramedTransport (org.apache.thrift.transport.layered.TFramedTransport)5 Test (org.junit.Test)5 LoginException (javax.security.auth.login.LoginException)4 Hello (org.tech.model.Hello)4 URI (java.net.URI)3 ArrayList (java.util.ArrayList)3 UGIAssumingTransport (org.apache.accumulo.core.rpc.UGIAssumingTransport)3 AccumuloProxy (org.apache.accumulo.proxy.thrift.AccumuloProxy)3