Interface TimeEstimator

  • All Known Implementing Classes:
    ProportionalTimeEstimatorImpl, TransferState

    public interface TimeEstimator
    Estimates the time left (ETA) during image resource upload to the server. Uses a exponential moving average as the calculation algorithm. Internally, the object keeps track of previous estimations in a circular buffer. The user of this API is responsible for instantiating a new object every time the state has to be reset.
    Since:
    5.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long getUploadTimeLeft()
      Return the estimated time left in milliseconds based on the calls to start and stop methods.
      void start()
      Starts the time counting.
      void stop()
      Stops the time counting and updates the internal time counter.
      void stop​(long uploadedBytes)
      Stops the time counting and updates the internal updates the internal time counter and counter of total number of transmitted bytes.
    • Method Detail

      • start

        void start()
        Starts the time counting.
      • stop

        void stop()
        Stops the time counting and updates the internal time counter.
      • stop

        void stop​(long uploadedBytes)
        Stops the time counting and updates the internal updates the internal time counter and counter of total number of transmitted bytes.
        Parameters:
        uploadedBytes - Number of bytes uploaded in a single time frame that is being sampled.
      • getUploadTimeLeft

        long getUploadTimeLeft()
        Return the estimated time left in milliseconds based on the calls to start and stop methods.
        Returns:
        The estimated time remaining. The value 0 is returned if stop hasn't been called at least once before calling this method.