File Download Task
Downloads a file from a URL to a destination file.
A FileDownloadTask supports:
Starting the download by calling start.
Pausing and resuming the download if the server supports it. Call pause to pause a download and start to resume it. If pausing is not supported, canPause will always emit false. If pausing is supported, canPause will emit true after the download has started.
Cancelling the download by calling cancel.
Progress updates if the server supports it, by emitting ProgressInfo in the progress state flow. If progress is not supported by the server, ProgressInfo.totalBytes will always return
null
.Download status is provided in the status state flow.
The download must be initiated by calling start, and client code can suspend until the download has completed by calling result.
Example:
val downloadTask = ArcGISEnvironment.arcGISHttpClient.downloadWithTask(url, destination)
downloadTask.start()
downloadTask.result().onSuccess {
// use file...
}.onFailure { error ->
// handle download error...
}
Since
200.6.0
Properties
Functions
Cancels the download. Successful cancellation will result in a Status.Failed status with an IOException.