Sha256: 28f687edaabf26e77d43e6bf8ceedde89bb373b7d84492e9f8d8ddc6ecdee423

Contents?: true

Size: 779 Bytes

Versions: 26

Compression:

Stored size: 779 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

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
amq-client-1.0.4 lib/amq/client/framing/io/frame.rb
amq-client-1.0.3 lib/amq/client/framing/io/frame.rb
amq-client-1.1.0.pre1 lib/amq/client/framing/io/frame.rb
amq-client-1.0.2 lib/amq/client/framing/io/frame.rb
amq-client-1.0.1 lib/amq/client/framing/io/frame.rb
amq-client-1.0.0 lib/amq/client/framing/io/frame.rb
amq-client-0.9.12 lib/amq/client/framing/io/frame.rb
amq-client-0.9.11 lib/amq/client/framing/io/frame.rb
amq-client-0.9.10 lib/amq/client/framing/io/frame.rb
amq-client-0.9.9 lib/amq/client/framing/io/frame.rb
amq-client-0.9.8 lib/amq/client/framing/io/frame.rb
amq-client-0.9.7 lib/amq/client/framing/io/frame.rb
amq-client-0.9.6 lib/amq/client/framing/io/frame.rb
amq-client-0.9.5 lib/amq/client/framing/io/frame.rb
amq-client-0.9.4 lib/amq/client/framing/io/frame.rb
amq-client-1.0.0.pre2 lib/amq/client/framing/io/frame.rb
amq-client-0.9.3 lib/amq/client/framing/io/frame.rb
amq-client-1.0.0.pre1 lib/amq/client/framing/io/frame.rb
amq-client-0.9.2 lib/amq/client/framing/io/frame.rb
amq-client-0.9.1 lib/amq/client/framing/io/frame.rb