public class MonitoredOutputStream extends OutputStream
OutputStream that invokes a progress(long, long) method
after each write, reporting the number of bytes processed. Applications can
subclass and override this method to provide features such as a progress bar.| Constructor and Description |
|---|
MonitoredOutputStream(OutputStream delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
void |
progress(long lastWrite,
long totalBytes)
Called after each operation that writes bytes, to report the number of
bytes written.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public MonitoredOutputStream(OutputStream delegate)
public void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void progress(long lastWrite,
long totalBytes)
lastWrite - Number of bytes in last write operation. Note that
this may be 0.totalBytes - Total number of bytes read or skipped since this
class was instantiated.