-
Notifications
You must be signed in to change notification settings - Fork 2.2k
BaseDownloadTask
Jacksgong edited this page Jul 10, 2016
·
12 revisions
For example:
FileDownloader.create(URL).setPath(xxx).setListener(xxx).start()
You can get more readable description from here
function | description |
---|---|
setPath(path:String) | Absolute path for save the download file |
setPath(path:String, pathAsDirectory:boolean) | If pathAsDirectory is true , the path would be the absolute directory to store the downloading file, and the filename will be found in contentDisposition from the response#header as default |
setListener | For callback download status(pending,connected,progress,blockComplete,retry,error,paused,completed,warn) |
setCallbackProgressTimes | Set the maximal callback count of FileDownloadListener#progress during the entire process of downloading |
setCallbackProgressIgnored | Ignore all callbacks of FileDownloadListener#progress during the entire process of downloading |
setCallbackProgressMinInterval | Set the minimum time interval between each callback of 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 the maximal callback count of FileDownloadListener#progress during the entire process of downloading |
getCallbackProgressMinInterval | Get the minimum time interval between each callback of FileDownloadListener#progress
|
getPath(void) | Get the absolute file path or the absolute directory. |
isPathAsDirectory(void) | Whether the result of getPath() is a directory path or directory/filename path |
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 |
isUsing | Whether this task object has already started and used in FileDownload Engine |
- Initialization
- Start downloading
- Pause or Stop
- Get the internal stored data
- Customizable Component
- Interface