class Helpers::SubStreamView

View of a stream that has a specified size in bytes

Attributes

end_pos[R]
size[R]

Public Class Methods

new(stream, start_pos, size) click to toggle source
Calls superclass method Helpers::BaseStreamView::new
# File lib/file_data/helpers/stream_view.rb, line 24
def initialize(stream, start_pos, size)
  super(stream, start_pos)
  @end_pos = @start_pos + size - 1
  @size = size
end

Public Instance Methods

eof?() click to toggle source
# File lib/file_data/helpers/stream_view.rb, line 34
def eof?
  pos > @end_pos || @stream.eof?
end
remaining_bytes() click to toggle source
# File lib/file_data/helpers/stream_view.rb, line 30
def remaining_bytes
  @end_pos - pos + 1
end