Package 

Interface DownloadCallback


  • 
    public interface DownloadCallback
    
                        

    This is a callback to be invoked when downloading.

    • Method Summary

      Modifier and Type Method Description
      Unit onStart(Integer downloadId, Long totalBytes) Invoked when downloading is started.
      Unit onRetry(Integer downloadId) Invoked when download retrying.
      Unit onProgress(Integer downloadId, Long bytesWritten, Long totalBytes) Invoked when downloading is in progress.
      Unit onSuccess(Integer downloadId, String filepath) Invoked when downloading successfully.
      Unit onFailure(Integer downloadId, Integer statusCode, String errMsg) Invoked when downloading failed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • onStart

        @MainThread() Unit onStart(Integer downloadId, Long totalBytes)

        Invoked when downloading is started.

        Parameters:
        downloadId - download id in download request queue
        totalBytes - total bytes of the file
      • onRetry

        @MainThread() Unit onRetry(Integer downloadId)

        Invoked when download retrying.

        Parameters:
        downloadId - download id in download request queue
      • onProgress

        @MainThread() Unit onProgress(Integer downloadId, Long bytesWritten, Long totalBytes)

        Invoked when downloading is in progress.

        Parameters:
        downloadId - download id in download request queue
        bytesWritten - the bytes has written to local disk
        totalBytes - total bytes of the file
      • onSuccess

        @MainThread() Unit onSuccess(Integer downloadId, String filepath)

        Invoked when downloading successfully.

        Parameters:
        downloadId - download id in download request queue
        filepath - the filepath of downloaded file
      • onFailure

        @MainThread() Unit onFailure(Integer downloadId, Integer statusCode, String errMsg)

        Invoked when downloading failed.

        Parameters:
        downloadId - download id in download request queue
        statusCode - status code
        errMsg - error message