Manually keep track of offset for unseekable streams.
The number of bytes remaining in the input stream.
# File lib/bindata/io.rb, line 130 def num_bytes_remaining raise IOError, "stream is unseekable" end
# File lib/bindata/io.rb, line 125 def offset_raw @offset end
All io calls in block are rolled back after this method
completes.
# File lib/bindata/io.rb, line 136 def with_readahead mark = @offset @read_data = "" @in_readahead = true class << self alias_method :read_raw_without_readahead, :read_raw alias_method :read_raw, :read_raw_with_readahead end begin yield ensure @offset = mark @in_readahead = false end end