Example usage for org.apache.thrift.transport TMemoryInputTransport TMemoryInputTransport

List of usage examples for org.apache.thrift.transport TMemoryInputTransport TMemoryInputTransport

Introduction

In this page you can find the example usage for org.apache.thrift.transport TMemoryInputTransport TMemoryInputTransport.

Prototype

public TMemoryInputTransport() 

Source Link

Usage

From source file:com.ambiata.poacher.mr.TDeserializerCopy.java

License:Apache License

/**
 * Create a new TDeserializer. It will use the TProtocol specified by the
 * factory that is passed in.// w w  w  .  jav a  2  s. c  o m
 *
 * @param protocolFactory Factory to create a protocol
 */
public TDeserializerCopy(TProtocolFactory protocolFactory) {
    trans_ = new TMemoryInputTransport();
    protocol_ = protocolFactory.getProtocol(trans_);
}

From source file:com.baidu.oped.apm.thrift.io.ChunkHeaderTBaseDeserializer.java

License:Apache License

ChunkHeaderTBaseDeserializer(TProtocolFactory protocolFactory, TBaseLocator locator) {
    this.trans = new TMemoryInputTransport();
    this.protocol = protocolFactory.getProtocol(trans);
    this.locator = locator;
}

From source file:com.baidu.oped.apm.thrift.io.HeaderTBaseDeserializer.java

License:Apache License

/**
 * Create a new TDeserializer. It will use the TProtocol specified by the
 * factory that is passed in./*from   w  w  w. j  a  va  2 s. c  o  m*/
 *
 * @param protocolFactory Factory to create a protocol
 */
HeaderTBaseDeserializer(TProtocolFactory protocolFactory, TBaseLocator locator) {
    this.trans = new TMemoryInputTransport();
    this.protocol = protocolFactory.getProtocol(trans);
    this.locator = locator;
}

From source file:com.linecorp.armeria.server.thrift.ThriftServiceTest.java

License:Apache License

@Before
public void before() {
    in = new TMemoryInputTransport();
    out = new TMemoryBuffer(128);
    inProto = ThriftProtocolFactories.get(defaultSerializationFormat).getProtocol(in);
    outProto = ThriftProtocolFactories.get(defaultSerializationFormat).getProtocol(out);

    promise = new CompletableFuture<>();
    promise2 = new CompletableFuture<>();
}

From source file:io.warp10.quasar.encoder.QuasarTokenDecoder.java

License:Apache License

/**
 * Deserialize the given byte array into any type of Thrift tokens
 * This method avoid an explicit cast on the deserialized token
 * @param base The Thrift instance// www.  jav  a  2s .  c  o  m
 * @param bytes the serialized thrift token
 */
private void deserializeThriftToken(TBase<?, ?> base, byte[] bytes) throws TException {
    // Thrift deserialization
    TMemoryInputTransport trans_ = new TMemoryInputTransport();
    TProtocol protocol_ = new TCompactProtocol.Factory().getProtocol(trans_);
    try {
        trans_.reset(bytes);
        // TRASH THE 8 fist bytes (SIP HASH)
        trans_.consumeBuffer(8);
        base.read(protocol_);
    } finally {
        trans_.clear();
        protocol_.reset();
    }
}

From source file:org.apache.jena.hadoop.rdf.types.converters.ThriftConverter.java

License:Apache License

private static TMemoryInputTransport getInputTransport() {
    TMemoryInputTransport transport = inputTransports.get();
    if (transport != null)
        return transport;

    transport = new TMemoryInputTransport();
    inputTransports.set(transport);//from  ww w.  j a v  a 2 s.  com
    return transport;
}

From source file:org.diqube.connection.integrity.IntegrityCheckingProtocolTest.java

License:Open Source License

@BeforeMethod
public void before() {
    outputMemoryBuf = new TMemoryBuffer(0);
    TBinaryProtocol outputBinaryProtocol = new TBinaryProtocol(new RememberingTransport(outputMemoryBuf));
    outputIntegrityValidatingProtocol = new IntegrityCheckingProtocol(outputBinaryProtocol, MAC_KEYS);

    inputMemoryTrans = new TMemoryInputTransport();
    TBinaryProtocol inputBinaryProtocol = new TBinaryProtocol(new RememberingTransport(inputMemoryTrans));
    inputIntegrityValidatingProtocol = new IntegrityCheckingProtocol(inputBinaryProtocol, MAC_KEYS);
}