public interface Downloader
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Downloader.ProgressListener
Listener notified when download progresses.
|
| Modifier and Type | Method and Description |
|---|---|
void |
download(Downloader.ProgressListener listener)
Downloads the media.
|
long |
getDownloadedBytes()
Returns the total number of downloaded bytes, or
C.LENGTH_UNSET if it hasn't been
calculated yet. |
float |
getDownloadPercentage()
Returns the download percentage, or
Float.NaN if it can't be calculated yet. |
void |
init()
Initializes the downloader.
|
void |
remove()
Removes all of the downloaded data of the media.
|
void init()
throws java.lang.InterruptedException,
java.io.IOException
DownloadException - Thrown if the media cannot be downloaded.java.lang.InterruptedException - If the thread has been interrupted.java.io.IOException - Thrown when there is an io error while reading from cache.getDownloadedBytes(),
getDownloadPercentage()void download(@Nullable
Downloader.ProgressListener listener)
throws java.lang.InterruptedException,
java.io.IOException
listener - If not null, called during download.DownloadException - Thrown if the media cannot be downloaded.java.lang.InterruptedException - If the thread has been interrupted.java.io.IOException - Thrown when there is an io error while downloading.void remove()
throws java.lang.InterruptedException
java.lang.InterruptedException - Thrown if the thread was interrupted.long getDownloadedBytes()
C.LENGTH_UNSET if it hasn't been
calculated yet.init()float getDownloadPercentage()
Float.NaN if it can't be calculated yet. This
value can be an estimation.init()