code: func (file *GridFile) Read(b []byte) (n int, err error) {
  	file.assertMode(gfsReading)
  	file.m.Lock()
  	debugf("GridFile %p: reading at offset %d into buffer of length %d", file, file.offset, len(b))
  	defer file.m.Unlock()
  	if file.offset == file.doc.Length {
  		return 0, io.EOF
  	}
  	for err == nil {
  		i := copy(b, file.rbuf)
  		n += i
  		file.offset += int64(i)
  		file.rbuf = file.rbuf[i:]
  		if i == len(b) || file.offset == file.doc.Length {
  			break
  		}
  		b = b[i:]
  		file.rbuf, err = file.getChunk()
  	}
  	return n, err
  }
docs: // Read reads into b the next available data from the file and
  // returns the number of bytes written and an error in case
  // something wrong happened.  At the end of the file, n will
  // be zero and err will be set to os.EOF.
  //
  // The parameters and behavior of this function turn the file
  // into an io.Reader.