Example usage for org.apache.thrift TDeserializer deserialize

List of usage examples for org.apache.thrift TDeserializer deserialize

Introduction

In this page you can find the example usage for org.apache.thrift TDeserializer deserialize.

Prototype

public void deserialize(TBase base, byte[] bytes, int offset, int length) throws TException 

Source Link

Document

Deserialize the Thrift object from a byte array.

Usage

From source file:org.apache.storm.utils.Utils.java

License:Apache License

public static <T> T thriftDeserialize(Class<T> c, byte[] b, int offset, int length) {
    try {//ww  w  .  j  a  v a 2  s. co m
        T ret = c.newInstance();
        TDeserializer des = getDes();
        des.deserialize((TBase) ret, b, offset, length);
        return ret;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}