def read_type(field_info)
      # if field_info is a Fixnum, assume it is a Thrift::Types constant
      # convert it into a field_info Hash for backwards compatibility
      if field_info.is_a? Fixnum
        field_info = {:type => field_info}
      end

      case field_info[:type]
      when Types::BOOL
        read_bool
      when Types::BYTE
        read_byte
      when Types::DOUBLE
        read_double
      when Types::I16
        read_i16
      when Types::I32
        read_i32
      when Types::I64
        read_i64
      when Types::STRING
        if field_info[:binary]
          read_binary
        else
          read_string
        end
      else
        raise NotImplementedError
      end
    end
def read_type(field_info)
      # if field_info is a Fixnum, assume it is a Thrift::Types constant
      # convert it into a field_info Hash for backwards compatibility
      if field_info.is_a? Fixnum
        field_info = {:type => field_info}
      end

      case field_info[:type]
      when Types::BOOL
        read_bool
      when Types::BYTE
        read_byte
      when Types::DOUBLE
        read_double
      when Types::I16
        read_i16
      when Types::I32
        read_i32
      when Types::I64
        read_i64
      when Types::STRING
        if field_info[:binary]
          read_binary
        else
          read_string
        end
      else
        raise NotImplementedError
      end
    end
Reads a field value based on the field information.

 field_info - A Hash containing the pertinent data to write:
              :type   - The Thrift::Types constant that determines how the value is written.
              :binary - A flag that indicates if Thrift::Types::STRING is a binary string (string without encoding).

 Returns the value read; object type varies based on field_info[:type].