minor: docs

This commit is contained in:
Kyle Banker 2010-02-19 17:05:52 -05:00
parent 6a09b141fd
commit 43452da5c6
2 changed files with 5 additions and 1 deletions

View File

@ -168,7 +168,7 @@ module Mongo
(@file_length / @chunk_size).to_i
end
# An optimized read method for reading the whole file.
# Read a file in its entirety (optimized).
def read_all
buf = ''
while true
@ -179,6 +179,7 @@ module Mongo
buf
end
# Read a file incrementally.
def read_length(length)
cache_chunk_data
remaining = (@file_length - @file_position)

View File

@ -50,6 +50,9 @@ class GridTest < Test::Unit::TestCase
file = @grid.get(id)
io.rewind
data = io.read
if data.respond_to?(:force_encoding)
data.force_encoding(:binary)
end
read_data = ""
while(chunk = file.read(read_length))
read_data << chunk