code: public static int readFully(Reader reader, char ch[], int off, int len) throws IOException{
  	    if(len<0)
  	        throw new IndexOutOfBoundsException();
  	    int n = 0;
  	    while(n<len){
  	        int count = reader.read(ch, off+n, len-n);
  	        if(count<0)
  		        return n;
  	        n += count;
  	    }
          return n;
      }
docs: Reads <code>len</code> chars from given reader into specified buffer.<br>
  If the given reader doesn't have <code>len</code> chars available,
  it simply reads only the availabel number of chars.
  
  @param reader    input stream from which data is read
  @param ch         the buffer into which the data is read.
  @param off       an int specifying the offset into the data.
  @param len       an int specifying the number of chars to read.
  @return          the number of chars read. if the reader doen't have <code>len</code> chars available
  it returns the the number of chars read
  @throws IOException if an I/O error occurs.