Package 

Interface IDownloadManager


  • 
    public interface IDownloadManager
    
                        

    Defines the contract of a download manager, which can used to queue and manage download requests.

    • Method Detail

      • createDownloadRequestSet

        @NonNull() abstract Observable<DownloadRequestSet> createDownloadRequestSet(@Nullable() RequestConfig requestConfig, long estimatedSize, @NonNull() DownloadManager.Listener listener)

        Creates an empty download request set with the specified estimated size.

        Please note the operation will be carried on a background i/o thread.

        Parameters:
        requestConfig - the configuration to be used for handling the download requests.
        estimatedSize - the estimated total size of the download.
        listener - reference to the callback listener that must be notified about status changesrelated to this download request.
      • enqueueDownload

        @NonNull() abstract Observable<DownloadRequestSet> enqueueDownload(@NonNull() DownloadRequestSet requestSet, @NonNull() Array<IDownloadManager.IRequest> requests)

        Enqueues a set of download requests to the specified request set. The status of the downloadrequest set will be more to STATUS_PENDING immediately adding therequests to the database. The DownloadManager will start to process the downloadrequests after this call, because of network availability and current download queue load.

        Please note the operation will be carried on a background i/o thread.

        Parameters:
        requestSet - reference to the
        requests - the download requests to be enqueued.
      • pauseDownload

        @NonNull() abstract DownloadStatus pauseDownload(@Nullable() DownloadRequestSet requestSet)

        Pauses download of the specified request set, if it is not already paused.

        Parameters:
        requestSet - reference to the download request to be paused.
      • pauseDownload

        @NonNull() abstract DownloadStatus pauseDownload(@NonNull() Long requestSetKey)

        Pauses download of the specified request set, if it is not already paused.

        Parameters:
        requestSetKey - the unique identifier to the download request.
      • resumeDownload

        @NonNull() abstract DownloadStatus resumeDownload(@Nullable() DownloadRequestSet requestSet)

        Resumes download of the specified request set, if it is currently paused.

        Parameters:
        requestSet - reference to the download request to be resumed.
      • resumeDownload

        @NonNull() abstract DownloadStatus resumeDownload(@NonNull() Long requestSetKey)

        Resumes download of the specified request set, if it is currently paused.

        Parameters:
        requestSetKey - the unique identifier to the download request.
      • deleteDownload

         abstract boolean deleteDownload(@Nullable() DownloadRequestSet requestSet)

        Cancels all the download requests in the specified set and removes the download request set.

        Parameters:
        requestSet - the request set to be cancelled.
      • deleteDownload

         abstract boolean deleteDownload(@NonNull() Long requestSetKey)

        Cancels all the download requests in the specified set and removes the download request set.

        Parameters:
        requestSetKey - the unique identifier to the download request.
      • getDownloadStatus

        @NonNull() abstract DownloadStatus getDownloadStatus(@NonNull() Long requestSetKey)

        Queries the overall download status of the specified download request set.

        Parameters:
        requestSetKey - the unique identifier to the download request.
      • getDownloadStatus

        @NonNull() abstract DownloadStatus getDownloadStatus(@Nullable() DownloadRequestSet requestSet)

        Queries the overall download status of the specified download request set.

        Parameters:
        requestSet - reference to the download request set.