class AMQ::Protocol::Frame

def self.decode(*)

def self.decode(*)
  raise NotImplementedError.new <<-EOF
e supposed to redefine this method, because it's dependent on used IO adapter.
unctionality is part of the https://github.com/ruby-amqp/amq-client library.
  EOF
end

def self.decode_header(header)

def self.decode_header(header)
  raise EmptyResponseError if header == nil || header.empty?
  type_id, channel, size = header.unpack(PACK_CHAR_UINT16_UINT32)
  type = TYPES_REVERSE[type_id]
  raise FrameTypeError.new(TYPES_OPTIONS) unless type
  [type, channel, size]
end

def self.encode(type, payload, channel)

def self.encode(type, payload, channel)
  encode_to_array(type, payload, channel).join
end

def self.encode_to_array(type, payload, channel)

The channel number is 0 for all frames which are global to the connection and 1-65535 for frames that refer to specific channels.
def self.encode_to_array(type, payload, channel)
  raise RuntimeError.new("Channel has to be 0 or an integer in range 1..65535 but was #{channel.inspect}") unless CHANNEL_RANGE.include?(channel)
  raise RuntimeError.new("Payload can't be nil") if payload.nil?
  components = []
  components << [find_type(type), channel, payload.bytesize].pack(PACK_CHAR_UINT16_UINT32)
  components << encoded_payload(payload)
  components << FINAL_OCTET
  components
end

def self.encoded_payload(payload)

def self.encoded_payload(payload)
  if payload.respond_to?(:force_encoding) && payload.encoding.name != 'BINARY'
    # Only copy if we have to.
    payload = payload.dup.force_encoding('BINARY')
  end
  payload
end

def self.find_type(type)

def self.find_type(type)
  type_id = if Symbol === type then TYPES[type] else type end
  raise FrameTypeError.new(TYPES_OPTIONS) if type == nil || !TYPES_REVERSE.has_key?(type_id)
  type_id
end

def self.new(original_type, *args)

def self.new(original_type, *args)
  type_id = find_type(original_type)
  klass = CLASSES[type_id]
  klass.new(*args)
end

def final?

def final?
  true
end