Class Thrift::CompactProtocol::CompactTypes
In: ruby/lib/thrift/protocol/compact_protocol.rb
Parent: Object

All of the on-wire type codes.

Methods

Constants

BOOLEAN_TRUE = 0x01
BOOLEAN_FALSE = 0x02
BYTE = 0x03
I16 = 0x04
I32 = 0x05
I64 = 0x06
DOUBLE = 0x07
BINARY = 0x08
LIST = 0x09
SET = 0x0A
MAP = 0x0B
STRUCT = 0x0C
COMPACT_TO_TTYPE = { Types::STOP => Types::STOP, BOOLEAN_FALSE => Types::BOOL, BOOLEAN_TRUE => Types::BOOL, BYTE => Types::BYTE, I16 => Types::I16, I32 => Types::I32, I64 => Types::I64, DOUBLE => Types::DOUBLE, BINARY => Types::STRING, LIST => Types::LIST, SET => Types::SET, MAP => Types::MAP, STRUCT => Types::STRUCT
TTYPE_TO_COMPACT = { Types::STOP => Types::STOP, Types::BOOL => BOOLEAN_TRUE, Types::BYTE => BYTE, Types::I16 => I16, Types::I32 => I32, Types::I64 => I64, Types::DOUBLE => DOUBLE, Types::STRING => BINARY, Types::LIST => LIST, Types::SET => SET, Types::MAP => MAP, Types::STRUCT => STRUCT

Public Class methods

[Source]

    # File ruby/lib/thrift/protocol/compact_protocol.rb, line 89
89:       def self.get_compact_type(ttype)
90:         val = TTYPE_TO_COMPACT[ttype]
91:         raise "don't know what type: #{ttype & 0x0f}" unless val
92:         val
93:       end

[Source]

    # File ruby/lib/thrift/protocol/compact_protocol.rb, line 83
83:       def self.get_ttype(compact_type)
84:         val = COMPACT_TO_TTYPE[compact_type & 0x0f]
85:         raise "don't know what type: #{compact_type & 0x0f}" unless val
86:         val
87:       end

[Source]

    # File ruby/lib/thrift/protocol/compact_protocol.rb, line 48
48:       def self.is_bool_type?(b)
49:         (b & 0x0f) == BOOLEAN_TRUE || (b & 0x0f) == BOOLEAN_FALSE
50:       end

[Validate]