Class ProgressInputStream

All Implemented Interfaces:
Closeable, AutoCloseable

public class ProgressInputStream
extends InputStreamTracker
Input stream wrapper that calls a progress reporter at regular intervals. The default interval is 1MB of processed data. The default progress message is simply to write the number of bytes processed. If a different message is required the progressReport(String) method should be overridden.
Since:
3.9
Author:
nicklas
  • Field Details

    • progress

      protected final AbsoluteProgressReporter progress
    • interval

      protected final long interval
    • nextProgress

      protected long nextProgress
  • Constructor Details

  • Method Details

    • read

      public int read​(byte[] b, int off, int len) throws IOException
      Overrides:
      read in class InputStreamTracker
      Throws:
      IOException
    • progressReport

      protected void progressReport​(String message)
      Send a progress report with the given message. This method is called automatically at the given intervals. The default message is the number of bytes read so far (formatted as a string with Values.formatBytes(Long, int)). Subclasses may override this method to generate a different message.