Search in sources :

Example 21 with TDeserializer

use of org.apache.thrift.TDeserializer in project brisk by riptano.

the class CassandraStorage method cfdefFromString.

private static CfDef cfdefFromString(String st) {
    assert st != null;
    TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());
    CfDef cfDef = new CfDef();
    try {
        deserializer.deserialize(cfDef, FBUtilities.hexToBytes(st));
    } catch (TException e) {
        throw new RuntimeException(e);
    }
    return cfDef;
}
Also used : TException(org.apache.thrift.TException) TDeserializer(org.apache.thrift.TDeserializer)

Example 22 with TDeserializer

use of org.apache.thrift.TDeserializer in project jstorm by alibaba.

the class GzipThriftSerializationDelegate method deserialize.

@Override
public <T> T deserialize(byte[] bytes, Class<T> clazz) {
    try {
        TBase instance = (TBase) clazz.newInstance();
        new TDeserializer().deserialize(instance, Utils.gunzip(bytes));
        return (T) instance;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : TDeserializer(org.apache.thrift.TDeserializer) TBase(org.apache.thrift.TBase) TException(org.apache.thrift.TException) IOException(java.io.IOException)

Example 23 with TDeserializer

use of org.apache.thrift.TDeserializer in project jstorm by alibaba.

the class Utils method getDes.

private static TDeserializer getDes() {
    TDeserializer des = threadDes.get();
    if (des == null) {
        des = new TDeserializer();
        threadDes.set(des);
    }
    return des;
}
Also used : TDeserializer(org.apache.thrift.TDeserializer)

Example 24 with TDeserializer

use of org.apache.thrift.TDeserializer in project jstorm by alibaba.

the class ThriftSerializationDelegate method deserialize.

@Override
public <T> T deserialize(byte[] bytes, Class<T> clazz) {
    try {
        TBase instance = (TBase) clazz.newInstance();
        new TDeserializer().deserialize(instance, bytes);
        return (T) instance;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : TDeserializer(org.apache.thrift.TDeserializer) TBase(org.apache.thrift.TBase) TException(org.apache.thrift.TException)

Example 25 with TDeserializer

use of org.apache.thrift.TDeserializer in project jstorm by alibaba.

the class Utils method thriftDeserialize.

public static <T> T thriftDeserialize(Class c, byte[] b, int offset, int length) {
    try {
        T ret = (T) c.newInstance();
        TDeserializer des = getDes();
        des.deserialize((TBase) ret, b, offset, length);
        return ret;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : TDeserializer(org.apache.thrift.TDeserializer) RT(clojure.lang.RT) FileNotFoundException(java.io.FileNotFoundException) ParseException(org.json.simple.parser.ParseException) TException(org.apache.thrift.TException) IOException(java.io.IOException)

Aggregations

TDeserializer (org.apache.thrift.TDeserializer)30 TException (org.apache.thrift.TException)19 IOException (java.io.IOException)8 TBase (org.apache.thrift.TBase)6 Table (org.apache.hadoop.hive.metastore.api.Table)4 TBinaryProtocol (org.apache.cassandra.thrift.TBinaryProtocol)3 HCatException (org.apache.hive.hcatalog.common.HCatException)3 ThriftSerializedObject (org.apache.storm.generated.ThriftSerializedObject)3 TJSONProtocol (org.apache.thrift.protocol.TJSONProtocol)3 LoggerFactory (org.slf4j.LoggerFactory)3 RT (clojure.lang.RT)2 FileNotFoundException (java.io.FileNotFoundException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 SlicePredicate (org.apache.cassandra.thrift.SlicePredicate)2 ExecuteException (org.apache.commons.exec.ExecuteException)2 Partition (org.apache.hadoop.hive.metastore.api.Partition)2 ParseException (org.json.simple.parser.ParseException)2 Example (com.airbnb.aerosolve.core.Example)1 AgentStatMemoryGcBo (com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo)1