Module: FileWithBufferedRead

Defined in:
lib/file_with_read_buffer.rb

Constant Summary collapse

READ_BUFFER_SIZE =
1 << 22

Instance Method Summary collapse

Instance Method Details

#buffered_read(size) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/file_with_read_buffer.rb', line 6

def buffered_read size
  output = read_buffer.read(size)
  until output.nil? or output.size == size or self.eof?
    output << read_buffer.read(size - output.size)
  end
  return output
end