code: private static final void copy(Reader r, Writer w, int blockSize, long timeout) throws IOException {
  	if (timeout < 1) {
  	    char[] buffer = new char[blockSize];
  	    int len;
  
  	    while ((len = r.read(buffer)) != -1)
  		w.write(buffer, 0, len);
  	}
  	else {
  	    Copy c = new Copy(r, w, blockSize, timeout);
  	    c.start();
  
  	    try {
  		synchronized (c.notifier) {// print.err(timeout);
  		    c.notifier.wait(timeout + 1);
  		}
  	    }
  	    catch (InterruptedException ie) {
  		throw ExceptionUtil.toIOException(c.t);
  	    }
  	    if (c.t != null) throw ExceptionUtil.toIOException(c.t);
  	    if (!c.finished) throw new IOException("reached timeout (" + timeout + "ms) while copying data");
  
  	}
      }
docs: copy a reader to a writer
  
  @param r
  @param w
  @param blockSize
  @throws IOException