Module: BinData::IO::Common::SeekableStream

Defined in:
lib/bindata/io.rb

Overview

Use #seek and #pos on seekable streams

Instance Method Summary collapse

Instance Method Details

#num_bytes_remainingObject

The number of bytes remaining in the input stream.



71
72
73
74
75
76
77
78
# File 'lib/bindata/io.rb', line 71

def num_bytes_remaining
  mark = @raw_io.pos
  @raw_io.seek(0, ::IO::SEEK_END)
  bytes_remaining = @raw_io.pos - mark
  @raw_io.seek(mark, ::IO::SEEK_SET)

  bytes_remaining
end