Class: BinData::CountBytesRemaining

Inherits:
BasePrimitive
  • Object
show all
Defined in:
lib/bindata/count_bytes_remaining.rb

Overview

Counts the number of bytes remaining in the input stream from the current position to the end of the stream. This only makes sense for seekable streams.

require 'bindata'

class A < BinData::Record
count_bytes_remaining :bytes_remaining
string :all_data, read_length: :bytes_remaining
end

obj = A.read("abcdefghij")
obj.all_data #=> "abcdefghij"