class BinData::CountBytesRemaining

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"

Private Instance Methods

read_and_return_value(io) click to toggle source
# File lib/bindata/count_bytes_remaining.rb, line 26
def read_and_return_value(io)
  io.num_bytes_remaining
end
sensible_default() click to toggle source
# File lib/bindata/count_bytes_remaining.rb, line 30
def sensible_default
  0
end
value_to_binary_string(val) click to toggle source
# File lib/bindata/count_bytes_remaining.rb, line 22
def value_to_binary_string(val)
  ""
end