Module methanol

Class ProgressTracker


  • public final class ProgressTracker
    extends java.lang.Object
    A progress tracker for upload and download operations.
    • Method Detail

      • bytesTransferredThreshold

        public long bytesTransferredThreshold()
        Returns the minimum number of bytes to be transferred for a progress event to be signalled.
      • timePassedThreshold

        public java.util.Optional<java.time.Duration> timePassedThreshold()
        Returns the minimum time to pass for a progress event to be signalled.
      • enclosedProgress

        public boolean enclosedProgress()
        Returns whether the sequence of progress events is enclosed between 0% and 100% progress events.
      • executor

        public java.util.Optional<java.util.concurrent.Executor> executor()
        Returns the optional executor on which ProgressTracker.Listener methods are called.
      • tracking

        public java.net.http.HttpRequest.BodyPublisher tracking​(java.net.http.HttpRequest.BodyPublisher upstream,
                                                                ProgressTracker.Listener listener)
        Returns a BodyPublisher that tracks the given BodyPublisher's upload progress.
      • tracking

        public <T> java.net.http.HttpResponse.BodySubscriber<T> tracking​(java.net.http.HttpResponse.BodySubscriber<T> downstream,
                                                                         ProgressTracker.Listener listener,
                                                                         long contentLengthIfKnown)
        Returns a BodySubscriber that tracks the given BodySubscriber's download progress. contentLengthIfKnown is the total length of downloaded content or a negative value if unknown.
      • tracking

        public <T> java.net.http.HttpResponse.BodyHandler<T> tracking​(java.net.http.HttpResponse.BodyHandler<T> handler,
                                                                      ProgressTracker.Listener listener)
        Returns a BodyHandler that tracks the download progress of the BodySubscriber returned by the given handler.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • create

        public static ProgressTracker create()
        Returns a default ProgressTracker with no thresholds or executor.