Class: AMQ::Client::Framing::IO::Frame
- Inherits:
-
Protocol::Frame
- Object
- Protocol::Frame
- AMQ::Client::Framing::IO::Frame
- Defined in:
- lib/amq/client/framing/io/frame.rb
Class Method Summary collapse
Class Method Details
.decode(io) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/amq/client/framing/io/frame.rb', line 11 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 |