Parent

Class Index [+]

Quicksearch

AMQ::Protocol::Basic

Constants

PROPERTIES
DECODE_PROPERTIES

THIS DECODES ONLY FLAGS

DECODE_PROPERTIES_TYPE
DECODE_PROPERTIES_KEYS

Hash doesn“t give any guarantees on keys order, we will do it in a straightforward way

Public Class Methods

decode_properties(data) click to toggle source
      # File lib/amq/protocol/client.rb, line 1459
1459:       def self.decode_properties(data)
1460:         offset, data_length, properties = 0, data.bytesize, {}
1461: 
1462:         compressed_index = data[offset, 2].unpack(PACK_UINT16)[0]
1463:         offset += 2
1464:         while data_length > offset
1465:           DECODE_PROPERTIES_KEYS.each do |key|
1466:             next unless compressed_index >= key
1467:             compressed_index -= key
1468:             name = DECODE_PROPERTIES[key] || raise(RuntimeError.new("No property found for index #{index.inspect}!"))
1469:             case DECODE_PROPERTIES_TYPE[key]
1470:             when :shortstr
1471:               size = data[offset, 1].unpack(PACK_CHAR)[0]
1472:               offset += 1
1473:               result = data[offset, size]
1474:             when :octet
1475:               size = 1
1476:               result = data[offset, size].unpack(PACK_CHAR).first
1477:             when :timestamp
1478:               size = 8
1479:               result = Time.at(data[offset, size].unpack(PACK_UINT32_X2).last)
1480:             when :table
1481:               size = 4 + data[offset, 4].unpack(PACK_UINT32)[0]
1482:               result = Table.decode(data[offset, size])
1483:             end
1484:             properties[name] = result
1485:             offset += size
1486:           end
1487:         end
1488: 
1489:         properties
1490:       end
encode_app_id(value) click to toggle source

1 << 3

      # File lib/amq/protocol/client.rb, line 1374
1374:       def self.encode_app_id(value)
1375:         buffer = ""
1376:         buffer << value.bytesize.chr
1377:         buffer << value
1378:         [12, 0x0008, buffer]
1379:       end
encode_cluster_id(value) click to toggle source

1 << 2

      # File lib/amq/protocol/client.rb, line 1382
1382:       def self.encode_cluster_id(value)
1383:         buffer = ""
1384:         buffer << value.bytesize.chr
1385:         buffer << value
1386:         [13, 0x0004, buffer]
1387:       end
encode_content_encoding(value) click to toggle source

1 << 14

      # File lib/amq/protocol/client.rb, line 1290
1290:       def self.encode_content_encoding(value)
1291:         buffer = ""
1292:         buffer << value.bytesize.chr
1293:         buffer << value
1294:         [1, 0x4000, buffer]
1295:       end
encode_content_type(value) click to toggle source

1 << 15

      # File lib/amq/protocol/client.rb, line 1282
1282:       def self.encode_content_type(value)
1283:         buffer = ""
1284:         buffer << value.bytesize.chr
1285:         buffer << value
1286:         [0, 0x8000, buffer]
1287:       end
encode_correlation_id(value) click to toggle source

1 << 10

      # File lib/amq/protocol/client.rb, line 1319
1319:       def self.encode_correlation_id(value)
1320:         buffer = ""
1321:         buffer << value.bytesize.chr
1322:         buffer << value
1323:         [5, 0x0400, buffer]
1324:       end
encode_delivery_mode(value) click to toggle source

1 << 12

      # File lib/amq/protocol/client.rb, line 1305
1305:       def self.encode_delivery_mode(value)
1306:         buffer = ""
1307:         buffer << [value].pack(PACK_CHAR)
1308:         [3, 0x1000, buffer]
1309:       end
encode_expiration(value) click to toggle source

1 << 8

      # File lib/amq/protocol/client.rb, line 1335
1335:       def self.encode_expiration(value)
1336:         buffer = ""
1337:         buffer << value.bytesize.chr
1338:         buffer << value
1339:         [7, 0x0100, buffer]
1340:       end
encode_headers(value) click to toggle source

1 << 13

      # File lib/amq/protocol/client.rb, line 1298
1298:       def self.encode_headers(value)
1299:         buffer = ""
1300:         buffer << AMQ::Protocol::Table.encode(value)
1301:         [2, 0x2000, buffer]
1302:       end
encode_message_id(value) click to toggle source

1 << 7

      # File lib/amq/protocol/client.rb, line 1343
1343:       def self.encode_message_id(value)
1344:         buffer = ""
1345:         buffer << value.bytesize.chr
1346:         buffer << value
1347:         [8, 0x0080, buffer]
1348:       end
encode_priority(value) click to toggle source

1 << 11

      # File lib/amq/protocol/client.rb, line 1312
1312:       def self.encode_priority(value)
1313:         buffer = ""
1314:         buffer << [value].pack(PACK_CHAR)
1315:         [4, 0x0800, buffer]
1316:       end
encode_properties(body_size, properties) click to toggle source
      # File lib/amq/protocol/client.rb, line 1389
1389:       def self.encode_properties(body_size, properties)
1390:         pieces, flags = [], 0
1391: 
1392:         properties.each do |key, value|
1393:           i, f, result = self.send(:"encode_#{key}", value)
1394:           flags |= f
1395:           pieces[i] = result
1396:         end
1397: 
1398:         # result = [60, 0, body_size, flags].pack("n2Qn")
1399:         result = [60, 0].pack(PACK_UINT16_X2)
1400:         result += AMQ::Hacks.pack_64_big_endian(body_size)
1401:         result += [flags].pack(PACK_UINT16)
1402:         result + pieces.join(EMPTY_STRING)
1403:       end
encode_reply_to(value) click to toggle source

1 << 9

      # File lib/amq/protocol/client.rb, line 1327
1327:       def self.encode_reply_to(value)
1328:         buffer = ""
1329:         buffer << value.bytesize.chr
1330:         buffer << value
1331:         [6, 0x0200, buffer]
1332:       end
encode_timestamp(value) click to toggle source

1 << 6

      # File lib/amq/protocol/client.rb, line 1351
1351:       def self.encode_timestamp(value)
1352:         buffer = ""
1353:         buffer << AMQ::Hacks.pack_64_big_endian(value)
1354:         [9, 0x0040, buffer]
1355:       end
encode_type(value) click to toggle source

1 << 5

      # File lib/amq/protocol/client.rb, line 1358
1358:       def self.encode_type(value)
1359:         buffer = ""
1360:         buffer << value.bytesize.chr
1361:         buffer << value
1362:         [10, 0x0020, buffer]
1363:       end
encode_user_id(value) click to toggle source

1 << 4

      # File lib/amq/protocol/client.rb, line 1366
1366:       def self.encode_user_id(value)
1367:         buffer = ""
1368:         buffer << value.bytesize.chr
1369:         buffer << value
1370:         [11, 0x0010, buffer]
1371:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.