org.apache.thrift
Class TDeserializer

java.lang.Object
  extended by org.apache.thrift.TDeserializer

public class TDeserializer
extends java.lang.Object

Generic utility for easily deserializing objects from a byte array or Java String.


Constructor Summary
TDeserializer()
          Create a new TDeserializer that uses the TBinaryProtocol by default.
TDeserializer(TProtocolFactory protocolFactory)
          Create a new TDeserializer.
 
Method Summary
 void deserialize(TBase base, byte[] bytes)
          Deserialize the Thrift object from a byte array.
 void deserialize(TBase base, java.lang.String data, java.lang.String charset)
          Deserialize the Thrift object from a Java string, using a specified character set for decoding.
 void fromString(TBase base, java.lang.String data)
          Deserialize the Thrift object from a Java string, using the default JVM charset encoding.
 void partialDeserialize(TBase tb, byte[] bytes, TFieldIdEnum... fieldIdPath)
          Deserialize only a single Thrift object (addressed by recursively using field id) from a byte record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TDeserializer

public TDeserializer()
Create a new TDeserializer that uses the TBinaryProtocol by default.


TDeserializer

public TDeserializer(TProtocolFactory protocolFactory)
Create a new TDeserializer. It will use the TProtocol specified by the factory that is passed in.

Parameters:
protocolFactory - Factory to create a protocol
Method Detail

deserialize

public void deserialize(TBase base,
                        byte[] bytes)
                 throws TException
Deserialize the Thrift object from a byte array.

Parameters:
base - The object to read into
bytes - The array to read from
Throws:
TException

deserialize

public void deserialize(TBase base,
                        java.lang.String data,
                        java.lang.String charset)
                 throws TException
Deserialize the Thrift object from a Java string, using a specified character set for decoding.

Parameters:
base - The object to read into
data - The string to read from
charset - Valid JVM charset
Throws:
TException

partialDeserialize

public void partialDeserialize(TBase tb,
                               byte[] bytes,
                               TFieldIdEnum... fieldIdPath)
                        throws TException
Deserialize only a single Thrift object (addressed by recursively using field id) from a byte record.

Parameters:
record - The object to read from
tb - The object to read into
fieldIdPath - The FieldId's that define a path tb
Throws:
TException

fromString

public void fromString(TBase base,
                       java.lang.String data)
                throws TException
Deserialize the Thrift object from a Java string, using the default JVM charset encoding.

Parameters:
base - The object to read into
data - The string to read from
Throws:
TException