-
Notifications
You must be signed in to change notification settings - Fork 2.2k
BaseDownloadTask
Jacksgong edited this page May 2, 2016
·
12 revisions
For example:
FileDownloader.create(URL).setPath(xxx).setListener(xxx).start()
You can get more readable description from here
| function | description |
|---|---|
| setPath | Absolute path for save the download file |
| setListener | For callback download status(pending,connected,progress,blockComplete,retry,error,paused,completed,warn) |
| setCallbackProgressTimes | Set maximal callback times on callback FileDownloadListener#progress
|
| setTag(object) | Sets the tag associated with this task, not be used by internal |
| setTag(key,object) | Sets a tag associated with this task. If the key already existed, the old tag will be replaced |
| setForceReDownload | If set to true, will not check whether the file is downloaded by past, default false |
| setFinishListener | - |
| setAutoRetryTimes | Set the number of times to automatically retry when encountering any error, default 0 |
| setSyncCallback | if true will invoke callbacks of FileDownloadListener directly on the download thread(do not post the message to the UI thread), default false |
| addHeader(name,value) | Add custom request header to the task. Attention: We have already handled ETag, and will add If-Match & Range value if it works |
| addHeader(line) | Add custom request header to the task. Attention: We have already handled ETag, and will add If-Match & Range value if it is exist |
| removeAllHeaders | Remove all custom request header bind with the {name}
|
| setMinIntervalUpdateSpeed | The min interval millisecond for updating the download speed in the downloading process(Status equal to progress). Default 5 ms. If less than or equal to 0, will not calculate the download speed in process |
| ready | Ready task( For queue task ) |
| start | Start task |
| pause | Pause task |
| getId | Get download id (generate by Url & path) |
| getUrl | Get download Url |
| getCallbackProgressTimes | Get maximal callback times on callback FileDownloadListener#progress
|
| getPath(void) | Get absolute path for save the download file |
| getListener | Get current listener |
| getSoFarBytes | Get already downloaded bytes |
| getTotalBytes | Get file total bytes |
| getStatus | Get current status |
| isForceReDownload | Force re-download,do not care about whether already downloaded or not |
| getEx | Get throwable |
| isReusedOldFile | Is reused downloaded old file |
| getTag(void) | Get the task's tag |
| getTag(key) | Get the object stored in the task as a tag, or null if not set. |
| isContinue | Is resume by breakpoint |
| getEtag | Get current ETag on header |
| getAutoRetryTimes | Get the number of times to automatically retry |
| getRetryingTimes | Get the current number of retry |
| isSyncCallback | Whether sync invokes callbacks of FileDownloadListener directly on the download thread |
| getSpeed | Get the download speed for a task. If it is in processing, the speed would be real-time speed; If finished, the speed would be average speed. Unit: KB/s |
- Initialization
- Start downloading
- Pause or Stop
- Get the internal stored data
- Customizable Component
- Interface