code: public int readAll(CharBuffer buf, int length) throws IOException
    {
      int len = buf.length();
  
      buf.length(len + length);
      int readLength = readAll(buf.buffer(), len, length);
      if (readLength < 0)
        buf.length(len);
      else if (readLength < length)
        buf.length(len + readLength);
  
      return length;
    }
docs: Reads characters from the stream, appending to the character buffer.
  <code>length</code> characters will always be read until the end of
  file.
  
  @param buf character buffer to fill
  @param length maximum number of characters to read
  @return number of characters read or -1 on end of file.