THIS DECODES ONLY FLAGS
Hash doesn't give any guarantees on keys order, we will do it in a straightforward way
# File lib/amq/protocol/client.rb, line 1536 def self.decode_properties(data) offset, data_length, properties = 0, data.bytesize, {} compressed_index = data[offset, 2].unpack(PACK_UINT16)[0] offset += 2 while data_length > offset DECODE_PROPERTIES_KEYS.each do |key| next unless compressed_index >= key compressed_index -= key name = DECODE_PROPERTIES[key] || raise(RuntimeError.new("No property found for index #{index.inspect}!")) case DECODE_PROPERTIES_TYPE[key] when :shortstr size = data[offset, 1].unpack(PACK_CHAR)[0] offset += 1 result = data[offset, size] when :octet size = 1 result = data[offset, size].unpack(PACK_CHAR).first when :timestamp size = 8 result = Time.at(data[offset, size].unpack(PACK_UINT32_X2).last) when :table size = 4 + data[offset, 4].unpack(PACK_UINT32)[0] result = Table.decode(data[offset, size]) end properties[name] = result offset += size end end properties end
1 << 3
# File lib/amq/protocol/client.rb, line 1449 def self.encode_app_id(value) buffer = '' buffer << value.bytesize.chr buffer << value [12, 0x0008, buffer] end
1 << 2
# File lib/amq/protocol/client.rb, line 1457 def self.encode_cluster_id(value) buffer = '' buffer << value.bytesize.chr buffer << value [13, 0x0004, buffer] end
1 << 14
# File lib/amq/protocol/client.rb, line 1365 def self.encode_content_encoding(value) buffer = '' buffer << value.bytesize.chr buffer << value [1, 0x4000, buffer] end
1 << 15
# File lib/amq/protocol/client.rb, line 1357 def self.encode_content_type(value) buffer = '' buffer << value.bytesize.chr buffer << value [0, 0x8000, buffer] end
1 << 10
# File lib/amq/protocol/client.rb, line 1394 def self.encode_correlation_id(value) buffer = '' buffer << value.bytesize.chr buffer << value [5, 0x0400, buffer] end
1 << 12
# File lib/amq/protocol/client.rb, line 1380 def self.encode_delivery_mode(value) buffer = '' buffer << [value].pack(PACK_CHAR) [3, 0x1000, buffer] end
1 << 8
# File lib/amq/protocol/client.rb, line 1410 def self.encode_expiration(value) buffer = '' buffer << value.bytesize.chr buffer << value [7, 0x0100, buffer] end
1 << 13
# File lib/amq/protocol/client.rb, line 1373 def self.encode_headers(value) buffer = '' buffer << AMQ::Protocol::Table.encode(value) [2, 0x2000, buffer] end
1 << 7
# File lib/amq/protocol/client.rb, line 1418 def self.encode_message_id(value) buffer = '' buffer << value.bytesize.chr buffer << value [8, 0x0080, buffer] end
1 << 11
# File lib/amq/protocol/client.rb, line 1387 def self.encode_priority(value) buffer = '' buffer << [value].pack(PACK_CHAR) [4, 0x0800, buffer] end
# File lib/amq/protocol/client.rb, line 1466 def self.encode_properties(body_size, properties) pieces, flags = [], 0 properties.reject {|key, value| value.nil?}.each do |key, value| i, f, result = self.__send__(:"encode_#{key}", value) flags |= f pieces[i] = result end # result = [60, 0, body_size, flags].pack('n2Qn') result = [60, 0].pack(PACK_UINT16_X2) result += AMQ::Hacks.pack_64_big_endian(body_size) result += [flags].pack(PACK_UINT16) result + pieces.join(EMPTY_STRING) end
1 << 9
# File lib/amq/protocol/client.rb, line 1402 def self.encode_reply_to(value) buffer = '' buffer << value.bytesize.chr buffer << value [6, 0x0200, buffer] end
1 << 6
# File lib/amq/protocol/client.rb, line 1426 def self.encode_timestamp(value) buffer = '' buffer << AMQ::Hacks.pack_64_big_endian(value) [9, 0x0040, buffer] end
Generated with the Darkfish Rdoc Generator 2.