public class FileDownloadSampleListener extends FileDownloadListener
FileDownloadListener.| Constructor and Description |
|---|
FileDownloadSampleListener() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
blockComplete(BaseDownloadTask task)
Unlike other methods in
FileDownloadListener.FileDownloadListener(int), BlockComplete is executed in other
thread than main as default, when you receive this execution, it means has already completed
downloading, but just block the execution of FileDownloadListener.completed(BaseDownloadTask). |
protected void |
completed(BaseDownloadTask task)
Achieve complete ceremony.
|
protected void |
error(BaseDownloadTask task,
Throwable e)
Occur a exception, but don't has any chance to retry.
|
protected void |
paused(BaseDownloadTask task,
int soFarBytes,
int totalBytes)
Task is paused, the vast majority of cases is invoking the
BaseDownloadTask.pause()
manually. |
protected void |
pending(BaseDownloadTask task,
int soFarBytes,
int totalBytes)
Enqueue, and pending, waiting for
FileDownloadListener.started(BaseDownloadTask). |
protected void |
progress(BaseDownloadTask task,
int soFarBytes,
int totalBytes)
Fetching datum from network and Writing to the local disk.
|
protected void |
warn(BaseDownloadTask task)
There has already had some same Tasks(Same-URL & Same-SavePath) in Pending-Queue or is
running.
|
connected, isInvalid, retry, startedprotected void pending(BaseDownloadTask task, int soFarBytes, int totalBytes)
FileDownloadListenerFileDownloadListener.started(BaseDownloadTask).pending in class FileDownloadListenertask - The tasksoFarBytes - Already downloaded and reusable bytes stored in the dbtotalBytes - Total bytes stored in the dbIFileDownloadMessenger.notifyPending(com.liulishuo.filedownloader.message.MessageSnapshot)protected void progress(BaseDownloadTask task, int soFarBytes, int totalBytes)
FileDownloadListenerprogress in class FileDownloadListenertask - The tasksoFarBytes - Number of bytes download so fartotalBytes - Total size of the download in bytesIFileDownloadMessenger.notifyProgress(com.liulishuo.filedownloader.message.MessageSnapshot)protected void blockComplete(BaseDownloadTask task)
FileDownloadListenerFileDownloadListener.FileDownloadListener(int), BlockComplete is executed in other
thread than main as default, when you receive this execution, it means has already completed
downloading, but just block the execution of FileDownloadListener.completed(BaseDownloadTask). therefore,
you can unzip or do some ending operation before FileDownloadListener.completed(BaseDownloadTask) in
other threads.blockComplete in class FileDownloadListenertask - the current taskIFileDownloadMessenger.notifyBlockComplete(com.liulishuo.filedownloader.message.MessageSnapshot)protected void completed(BaseDownloadTask task)
FileDownloadListenercompleted in class FileDownloadListenertask - The taskIFileDownloadMessenger.notifyCompleted(com.liulishuo.filedownloader.message.MessageSnapshot),
FileDownloadListener.blockComplete(BaseDownloadTask)protected void paused(BaseDownloadTask task, int soFarBytes, int totalBytes)
FileDownloadListenerBaseDownloadTask.pause()
manually.paused in class FileDownloadListenertask - The tasksoFarBytes - Number of bytes download so fartotalBytes - Total size of the download in bytesIFileDownloadMessenger.notifyPaused(com.liulishuo.filedownloader.message.MessageSnapshot)protected void error(BaseDownloadTask task, Throwable e)
FileDownloadListenererror in class FileDownloadListenertask - The taske - Any throwable on download pipelineIFileDownloadMessenger.notifyError(com.liulishuo.filedownloader.message.MessageSnapshot),
FileDownloadHttpException,
FileDownloadGiveUpRetryException,
FileDownloadOutOfSpaceExceptionprotected void warn(BaseDownloadTask task)
FileDownloadListenerwarn in class FileDownloadListenertask - The taskIFileDownloadMessenger.notifyWarn(com.liulishuo.filedownloader.message.MessageSnapshot)