T - the type of resultpublic abstract class DownloadTask<T> extends Object
A download task has the uri of resource to download, and the location to save, such as file, memory. The save location is handled by subclasses.
| Constructor and Description |
|---|
DownloadTask(String uri)
Constructs a DownloadTask.
|
DownloadTask(URI uri)
Constructs a DownloadTask.
|
| Modifier and Type | Method and Description |
|---|---|
<R> DownloadTask<R> |
andThen(ResultProcessor<T,R> processor) |
abstract DownloadSession<T> |
createSession()
Calls when the download task begins.
|
DownloadSession<T> |
createSession(long length)
Calls when the download task begins.
|
URI |
getURI()
Gets the uri of the resource to download.
|
public DownloadTask(String uri)
uri - the uri of resource to downloadNullPointerException - if uri==nullIllegalArgumentException - if uri is not in a valid
URI formatpublic DownloadTask(URI uri)
uri - the uri of resource to downloadNullPointerException - if uri==nullpublic URI getURI()
public abstract DownloadSession<T> createSession() throws IOException
IOException - if an I/O error occurspublic DownloadSession<T> createSession(long length) throws IOException
length - the possible length of dataIOException - if an I/O error occurspublic <R> DownloadTask<R> andThen(ResultProcessor<T,R> processor)
Copyright © 2016. All rights reserved.