Interface ProgressListener


public interface ProgressListener
Use this for three purposes a. implement a bandwidth throttle by putting a delay in onRead b. display progress information to the user in onProgress and onComplete c. allow the user to cancel transfers by implementing isCancelled
Author:
bradm
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    This is a means for the UI to inform that process that the user has cancelled the optioation If the implementation returns true the operation will abort
    void
    onComplete(String fileName)
    Called on completion
    void
    onProgress(long bytesRead, Long totalBytes, String fileName)
    Called occasionally, after a reasonable period has passed so is suitable for GUI updates
    void
    onRead(int bytes)
    Called on every read operation.
  • Method Details

    • onRead

      void onRead(int bytes)
      Called on every read operation. If you implement any logic in here is must be fast!
      Parameters:
      bytes - - the number of bytes read
    • onProgress

      void onProgress(long bytesRead, Long totalBytes, String fileName)
      Called occasionally, after a reasonable period has passed so is suitable for GUI updates
      Parameters:
      bytesRead -
      totalBytes - - is null if unknown
      fileName - - name of the file being transferred
    • onComplete

      void onComplete(String fileName)
      Called on completion
      Parameters:
      fileName -
    • isCancelled

      boolean isCancelled()
      This is a means for the UI to inform that process that the user has cancelled the optioation If the implementation returns true the operation will abort
      Returns: