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.
506 507 508 |
# File 'lib/avro/ipc.rb', line 506 def initialize(reader) @reader = reader end |
Instance Attribute Details
#reader ⇒ Object (readonly)
Returns the value of attribute reader.
504 505 506 |
# File 'lib/avro/ipc.rb', line 504 def reader @reader end |
Instance Method Details
#read_framed_message ⇒ Object
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
# File 'lib/avro/ipc.rb', line 510 def = [] loop do buffer = String.new('', 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 |