Class: BitGirder::Event::File::EventFileReader
- Inherits:
-
EventFileIo
- Object
- BitGirderClass
- EventFileIo
- BitGirder::Event::File::EventFileReader
show all
- Includes:
- Enumerable
- Defined in:
- lib/bitgirder/event/file.rb
Constant Summary
Constants inherited
from EventFileIo
BitGirder::Event::File::EventFileIo::DEFAULT_BUFFER_SIZE, BitGirder::Event::File::EventFileIo::HEADER_SIZE
Instance Method Summary
collapse
Instance Method Details
#each ⇒ Object
478
479
480
|
# File 'lib/bitgirder/event/file.rb', line 478
def each
each_with_loc { |ev, loc| yield( ev ) }
end
|
#each_with_loc ⇒ Object
469
470
471
472
473
474
475
|
# File 'lib/bitgirder/event/file.rb', line 469
def each_with_loc
until @io.eof?
ev, loc = *( read_event )
yield( ev, loc ) if loc
end
end
|
#read_event ⇒ Object
453
454
455
456
457
458
459
460
461
462
463
464
465
466
|
# File 'lib/bitgirder/event/file.rb', line 453
def read_event
unless @read_file_header
return nil if @io.eof?
loc = @bin.pos
len = @bin.read_int32
buf = @bin.read_full( len )
ev = @codec.decode_event( StringIO.new( buf, "r" ), len )
[ ev, loc ]
end
|