Method: BinData::Buffer::BufferIO#buffer_limited_n

Defined in:
lib/bindata/buffer.rb

#buffer_limited_n(n) ⇒ Object



169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/bindata/buffer.rb', line 169

def buffer_limited_n(n)
  if n.nil?
    @bytes_remaining
  elsif n.positive?
    limit = @bytes_remaining
    n > limit ? limit : n
# uncomment if we decide to allow backwards skipping
#        elsif n.negative?
#          limit = @bytes_remaining + @buf_start - @buf_end
#          n < limit ? limit : n
  else
    0
  end
end