/** * Overrides <code>FilterInputStream.read</code> to update the progress monitor after the read. */ public int read() throws IOException { int c = in.read(); if (c >= 0) monitor.setProgress(++nread); if (monitor.isCanceled()) { InterruptedIOException exc = new InterruptedIOException("progress"); exc.bytesTransferred = nread; throw exc; } return c; }
/** * Overrides <code>FilterInputStream.read</code> to update the progress monitor after the read. */ public int read(byte b[], int off, int len) throws IOException { int nr = in.read(b, off, len); if (nr > 0) monitor.setProgress(nread += nr); if (monitor.isCanceled()) { InterruptedIOException exc = new InterruptedIOException("progress"); exc.bytesTransferred = nread; throw exc; } return nr; }