Class TDeserializer


  • public class TDeserializer
    extends java.lang.Object
    Generic utility for easily deserializing objects from a byte array or Java String.
    • Constructor Summary

      Constructors 
      Constructor Description
      TDeserializer()
      Create a new TDeserializer that uses the TBinaryProtocol by default.
      TDeserializer​(TProtocolFactory protocolFactory)
      Create a new TDeserializer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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 fieldIdPathFirst, TFieldIdEnum... fieldIdPathRest)
      Deserialize only a single Thrift object (addressed by recursively using field id) from a byte record.
      java.lang.Boolean partialDeserializeBool​(byte[] bytes, TFieldIdEnum fieldIdPathFirst, TFieldIdEnum... fieldIdPathRest)
      Deserialize only a boolean field (addressed by recursively using field id) from a byte record.
      java.lang.Byte partialDeserializeByte​(byte[] bytes, TFieldIdEnum fieldIdPathFirst, TFieldIdEnum... fieldIdPathRest)
      Deserialize only a byte field (addressed by recursively using field id) from a byte record.
      java.nio.ByteBuffer partialDeserializeByteArray​(byte[] bytes, TFieldIdEnum fieldIdPathFirst, TFieldIdEnum... fieldIdPathRest)
      Deserialize only a binary field (addressed by recursively using field id) from a byte record.
      java.lang.Double partialDeserializeDouble​(byte[] bytes, TFieldIdEnum fieldIdPathFirst, TFieldIdEnum... fieldIdPathRest)
      Deserialize only a double field (addressed by recursively using field id) from a byte record.
      java.lang.Short partialDeserializeI16​(byte[] bytes, TFieldIdEnum fieldIdPathFirst, TFieldIdEnum... fieldIdPathRest)
      Deserialize only an i16 field (addressed by recursively using field id) from a byte record.
      java.lang.Integer partialDeserializeI32​(byte[] bytes, TFieldIdEnum fieldIdPathFirst, TFieldIdEnum... fieldIdPathRest)
      Deserialize only an i32 field (addressed by recursively using field id) from a byte record.
      java.lang.Long partialDeserializeI64​(byte[] bytes, TFieldIdEnum fieldIdPathFirst, TFieldIdEnum... fieldIdPathRest)
      Deserialize only an i64 field (addressed by recursively using field id) from a byte record.
      java.lang.Short partialDeserializeSetFieldIdInUnion​(byte[] bytes, TFieldIdEnum fieldIdPathFirst, TFieldIdEnum... fieldIdPathRest)
      Deserialize only the id of the field set in a TUnion (addressed by recursively using field id) from a byte record.
      java.lang.String partialDeserializeString​(byte[] bytes, TFieldIdEnum fieldIdPathFirst, TFieldIdEnum... fieldIdPathRest)
      Deserialize only a string field (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 fieldIdPathFirst,
                                       TFieldIdEnum... fieldIdPathRest)
                                throws TException
        Deserialize only a single Thrift object (addressed by recursively using field id) from a byte record.
        Parameters:
        tb - The object to read into
        bytes - The serialized object to read from
        fieldIdPathFirst - First of the FieldId's that define a path tb
        fieldIdPathRest - The rest FieldId's that define a path tb
        Throws:
        TException
      • partialDeserializeBool

        public java.lang.Boolean partialDeserializeBool​(byte[] bytes,
                                                        TFieldIdEnum fieldIdPathFirst,
                                                        TFieldIdEnum... fieldIdPathRest)
                                                 throws TException
        Deserialize only a boolean field (addressed by recursively using field id) from a byte record.
        Parameters:
        bytes - The serialized object to read from
        fieldIdPathFirst - First of the FieldId's that define a path to a boolean field
        fieldIdPathRest - The rest FieldId's that define a path to a boolean field
        Throws:
        TException
      • partialDeserializeByte

        public java.lang.Byte partialDeserializeByte​(byte[] bytes,
                                                     TFieldIdEnum fieldIdPathFirst,
                                                     TFieldIdEnum... fieldIdPathRest)
                                              throws TException
        Deserialize only a byte field (addressed by recursively using field id) from a byte record.
        Parameters:
        bytes - The serialized object to read from
        fieldIdPathFirst - First of the FieldId's that define a path to a byte field
        fieldIdPathRest - The rest FieldId's that define a path to a byte field
        Throws:
        TException
      • partialDeserializeDouble

        public java.lang.Double partialDeserializeDouble​(byte[] bytes,
                                                         TFieldIdEnum fieldIdPathFirst,
                                                         TFieldIdEnum... fieldIdPathRest)
                                                  throws TException
        Deserialize only a double field (addressed by recursively using field id) from a byte record.
        Parameters:
        bytes - The serialized object to read from
        fieldIdPathFirst - First of the FieldId's that define a path to a double field
        fieldIdPathRest - The rest FieldId's that define a path to a double field
        Throws:
        TException
      • partialDeserializeI16

        public java.lang.Short partialDeserializeI16​(byte[] bytes,
                                                     TFieldIdEnum fieldIdPathFirst,
                                                     TFieldIdEnum... fieldIdPathRest)
                                              throws TException
        Deserialize only an i16 field (addressed by recursively using field id) from a byte record.
        Parameters:
        bytes - The serialized object to read from
        fieldIdPathFirst - First of the FieldId's that define a path to an i16 field
        fieldIdPathRest - The rest FieldId's that define a path to an i16 field
        Throws:
        TException
      • partialDeserializeI32

        public java.lang.Integer partialDeserializeI32​(byte[] bytes,
                                                       TFieldIdEnum fieldIdPathFirst,
                                                       TFieldIdEnum... fieldIdPathRest)
                                                throws TException
        Deserialize only an i32 field (addressed by recursively using field id) from a byte record.
        Parameters:
        bytes - The serialized object to read from
        fieldIdPathFirst - First of the FieldId's that define a path to an i32 field
        fieldIdPathRest - The rest FieldId's that define a path to an i32 field
        Throws:
        TException
      • partialDeserializeI64

        public java.lang.Long partialDeserializeI64​(byte[] bytes,
                                                    TFieldIdEnum fieldIdPathFirst,
                                                    TFieldIdEnum... fieldIdPathRest)
                                             throws TException
        Deserialize only an i64 field (addressed by recursively using field id) from a byte record.
        Parameters:
        bytes - The serialized object to read from
        fieldIdPathFirst - First of the FieldId's that define a path to an i64 field
        fieldIdPathRest - The rest FieldId's that define a path to an i64 field
        Throws:
        TException
      • partialDeserializeString

        public java.lang.String partialDeserializeString​(byte[] bytes,
                                                         TFieldIdEnum fieldIdPathFirst,
                                                         TFieldIdEnum... fieldIdPathRest)
                                                  throws TException
        Deserialize only a string field (addressed by recursively using field id) from a byte record.
        Parameters:
        bytes - The serialized object to read from
        fieldIdPathFirst - First of the FieldId's that define a path to a string field
        fieldIdPathRest - The rest FieldId's that define a path to a string field
        Throws:
        TException
      • partialDeserializeByteArray

        public java.nio.ByteBuffer partialDeserializeByteArray​(byte[] bytes,
                                                               TFieldIdEnum fieldIdPathFirst,
                                                               TFieldIdEnum... fieldIdPathRest)
                                                        throws TException
        Deserialize only a binary field (addressed by recursively using field id) from a byte record.
        Parameters:
        bytes - The serialized object to read from
        fieldIdPathFirst - First of the FieldId's that define a path to a binary field
        fieldIdPathRest - The rest FieldId's that define a path to a binary field
        Throws:
        TException
      • partialDeserializeSetFieldIdInUnion

        public java.lang.Short partialDeserializeSetFieldIdInUnion​(byte[] bytes,
                                                                   TFieldIdEnum fieldIdPathFirst,
                                                                   TFieldIdEnum... fieldIdPathRest)
                                                            throws TException
        Deserialize only the id of the field set in a TUnion (addressed by recursively using field id) from a byte record.
        Parameters:
        bytes - The serialized object to read from
        fieldIdPathFirst - First of the FieldId's that define a path to a TUnion
        fieldIdPathRest - The rest FieldId's that define a path to a TUnion
        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