Module: AMQ::Pack

Defined in:
lib/amq/pack.rb

Overview

Implements pack to/unpack from 64bit string in network byte order compatible with Ruby 1.8+.

Constant Summary collapse

UINT64 =
"Q".freeze
UINT16_BE =
"n".freeze
INT16 =
"c".freeze

Class Method Summary collapse

Class Method Details

.pack_int16_big_endian(short) ⇒ Object



22
23
24
# File 'lib/amq/pack.rb', line 22

def self.pack_int16_big_endian(short)
  [long_long].pack(INT16)
end

.pack_uint64_big_endian(long_long) ⇒ Object



14
15
16
# File 'lib/amq/pack.rb', line 14

def self.pack_uint64_big_endian(long_long)
  [long_long].pack(UINT64)
end

.unpack_int16_big_endian(data) ⇒ Object



26
27
28
# File 'lib/amq/pack.rb', line 26

def self.unpack_int16_big_endian(data)
  data.unpack(INT16)
end

.unpack_uint64_big_endian(data) ⇒ Object



18
19
20
# File 'lib/amq/pack.rb', line 18

def self.unpack_uint64_big_endian(data)
  data.unpack(UINT64)
end