code: public int readAll(byte []buf, int offset, int length) throws IOException
    {
      int readOffset = _readOffset;
      int readLength = _readLength;
  
      int i = 0;
  
      while (true) {
        int sublen = Math.min(length - i, readLength - readOffset);
        
        System.arraycopy(_readBuffer, readOffset, buf, offset + i, sublen);
        
        i += sublen;
        
        if (length <= i) {
          _readOffset = readOffset + sublen;
          
          return i;
        }
        else {
          if (! readBuffer()) {
            return i == 0 ? -1 : i;
          }
  
          readOffset = _readOffset;
          readLength = _readLength;
        }
      }
    }
docs: Reads into a byte array.  <code>readAll</code> will always read
  <code>length</code> bytes, blocking if necessary, until the end of
  file is reached.
  
  @param buf byte array
  @param offset offset into the byte array to start reading
  @param length maximum byte allowed to read.
  
  @return number of bytes read or -1 on end of file.