List of usage examples for org.apache.thrift.transport TMemoryInputTransport reset
public void reset(byte[] buf)
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//w ww . ja v a 2s .com * @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
public static void fromBytes(byte[] bs, RDF_Term term) throws TException { TMemoryInputTransport transport = getInputTransport(); transport.reset(bs); TProtocol protocol = getInputProtocol(); term.read(protocol);//from w w w . ja v a 2 s . c om }
From source file:org.apache.jena.hadoop.rdf.types.converters.ThriftConverter.java
License:Apache License
public static void fromBytes(byte[] buffer, RDF_Triple triple) throws TException { TMemoryInputTransport transport = getInputTransport(); transport.reset(buffer); TProtocol protocol = getInputProtocol(); triple.read(protocol);//from w ww .ja va 2s .c om }
From source file:org.apache.jena.hadoop.rdf.types.converters.ThriftConverter.java
License:Apache License
public static void fromBytes(byte[] buffer, RDF_Quad quad) throws TException { TMemoryInputTransport transport = getInputTransport(); transport.reset(buffer); TProtocol protocol = getInputProtocol(); quad.read(protocol);/* w w w . j a va2 s. c om*/ }