Sha256: 7183b3f53b64afbb4c1debdfaf8c21fc308a02b09e14fdb7d4dac22fa005f9ff

Contents?: true

Size: 899 Bytes

Versions: 42

Compression:

Stored size: 899 Bytes

Contents

# encoding: utf-8

require "amq/client/exceptions"

module AMQ
  module Client
    module Framing
      module IO

        class Frame < AMQ::Protocol::Frame
          def self.decode(io)
            header = io.read(7)
            type, channel, size = self.decode_header(header)
            data = io.read(size + 1)
            payload, frame_end = data[0..-2], data[-1, 1]
            # TODO: this will hang if the size is bigger than expected or it'll leave there some chars -> make it more error-proof:
            # BTW: socket#eof?
            raise NoFinalOctetError.new if frame_end != AMQ::Protocol::Frame::FINAL_OCTET
            self.new(type, payload, channel)
          end # self.from

        end # Frame
      end # IO
    end # Framing
  end # Client
end # AMQ

class AMQ::Protocol::Frame
  def final?
    true ####### HACK for testing, implement & move to amq-protocol!
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
amq-client-0.8.5 lib/amq/client/framing/io/frame.rb
amq-client-0.8.4 lib/amq/client/framing/io/frame.rb
amq-client-0.8.3 lib/amq/client/framing/io/frame.rb
amq-client-0.8.2 lib/amq/client/framing/io/frame.rb
amq-client-0.8.1 lib/amq/client/framing/io/frame.rb
amq-client-0.8.0 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha35 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha34 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha33 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha32 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha31 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha30 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha29 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha28 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha27 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha26 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha25 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha24 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha23 lib/amq/client/framing/io/frame.rb
amq-client-0.7.0.alpha22 lib/amq/client/framing/io/frame.rb