public static int readFully(Reader in,char[] buffer,int max) throws IOException {
  try {
    int result=0, len=Math.min(max,buffer.length);
    while (len > 0) {
      int l=in.read(buffer,result,len);
      if (l < 0) {
        break;
      }
      result+=l;
      len-=l;
    }
    return result;
  }
 catch (  Exception e) {
    throw DbException.convertToIOException(e);
  }
}

public static int readFully ( Reader in , char [ ] buffer , int max ) throws IOException { try { int result = 0 , len = Math . min ( max , buffer . length ) ; while ( len > 0 ) { int l = in . read ( buffer , result , len ) ; if ( l < 0 ) { break ; } result += l ; len -= l ; } return result ; } catch ( Exception e ) { throw DbException . convertToIOException ( e ) ; } }
try to read the given number of characters to the buffer . this method reads until the maximum number of characters have been read or until the end of file .
