import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class ProgressMonitorOutputStream extends ByteCountingOutputStream {
int interval;
StreamProgressListener listener;
public ProgressMonitorOutputStream(OutputStream out, int updateInterval,
StreamProgressListener aListener) {
super(out);
this.interval = updateInterval;
this.listener = aListener;
}
public void write(int b) throws IOException {
super.write( b );
if ((bytesWritten % interval) == 0) {
listener.setStreamProgress(bytesWritten);
}
}
public void close() throws IOException {
super.close();
listener.setStreamClosed();
}
}
class ByteCountingOutputStream extends FilterOutputStream { </