protected static int readFully(Reader reader,char[] buf,int length) throws IOException {
  int numCharsRead=0;
  while (numCharsRead < length) {
    int count=reader.read(buf,numCharsRead,length - numCharsRead);
    if (count < 0) {
      break;
    }
    numCharsRead+=count;
  }
  return numCharsRead;
}

protected static int readFully ( Reader reader , char [ ] buf , int length ) throws IOException { int numCharsRead = 0 ; while ( numCharsRead < length ) { int count = reader . read ( buf , numCharsRead , length - numCharsRead ) ; if ( count < 0 ) { break ; } numCharsRead += count ; } return numCharsRead ; }
reads length bytes from reader into buf . blocks until enough input is available
