Class: Avro::IPC::FramedReader
- Inherits:
-
Object
- Object
- Avro::IPC::FramedReader
- Defined in:
- lib/avro/ipc.rb
Instance Attribute Summary collapse
-
#reader ⇒ Object
readonly
Returns the value of attribute reader.
Instance Method Summary collapse
-
#initialize(reader) ⇒ FramedReader
constructor
A new instance of FramedReader.
- #read_framed_message ⇒ Object
Constructor Details
#initialize(reader) ⇒ FramedReader
Returns a new instance of FramedReader.
502 503 504 |
# File 'lib/avro/ipc.rb', line 502 def initialize(reader) @reader = reader end |
Instance Attribute Details
#reader ⇒ Object (readonly)
Returns the value of attribute reader.
500 501 502 |
# File 'lib/avro/ipc.rb', line 500 def reader @reader end |
Instance Method Details
#read_framed_message ⇒ Object
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 |
# File 'lib/avro/ipc.rb', line 506 def = [] loop do buffer = ''.force_encoding('BINARY') buffer_size = read_buffer_size return .join if buffer_size == 0 while buffer.bytesize < buffer_size chunk = reader.read(buffer_size - buffer.bytesize) chunk_error?(chunk) buffer << chunk end << buffer end end |