public class ProgressMonitoredOutputStream extends java.io.OutputStream implements OutputStreamWrapper
BytesProgressWatcher
implementation
is notified of the count of bytes read since the last notification.Constructor and Description |
---|
ProgressMonitoredOutputStream(java.io.OutputStream outputStream,
BytesProgressWatcher progressWatcher)
Construts the input stream around an underlying stream and sends notification messages
to a progress watcher when bytes are read from the stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.io.OutputStream |
getWrappedOutputStream() |
void |
resetProgressMonitor() |
void |
sendNotificationUpdate(long bytesTransmitted)
Checks how many bytes have been transferred since the last notification, and sends a notification
message if this number exceeds the minimum bytes transferred value.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public ProgressMonitoredOutputStream(java.io.OutputStream outputStream, BytesProgressWatcher progressWatcher)
outputStream
- the output stream to wrap, whose byte transfer count will be monitored.progressWatcher
- a watcher object that stores information about the bytes read from a stream, and
allows calculations to be perfomed using this information.public void sendNotificationUpdate(long bytesTransmitted)
bytesTransmitted
- public void resetProgressMonitor()
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
public java.io.OutputStream getWrappedOutputStream()
getWrappedOutputStream
in interface OutputStreamWrapper