Class ProgressMonitoredOutputStream

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable, OutputStreamWrapper

    public class ProgressMonitoredOutputStream
    extends OutputStream
    implements OutputStreamWrapper
    Output stream wrapper that tracks the number of bytes that have been written through the stream. When data is written through this stream the count of bytes is increased, and at a set minimum interval (eg after at least 1024 bytes) a BytesProgressWatcher implementation is notified of the count of bytes read since the last notification.
    Author:
    James Murty
    • Constructor Detail

      • ProgressMonitoredOutputStream

        public ProgressMonitoredOutputStream​(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.
        Parameters:
        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.