DownloadIndexDefaultDownloadIndex@WorkerThread public interface WritableDownloadIndex extends DownloadIndex
Downloads.| Modifier and Type | Method | Description |
|---|---|---|
void |
putDownload(Download download) |
Adds or replaces a
Download. |
void |
removeDownload(String id) |
Removes the download with the given ID.
|
void |
setDownloadingStatesToQueued() |
Sets all
Download.STATE_DOWNLOADING states to Download.STATE_QUEUED. |
void |
setStatesToRemoving() |
Sets all states to
Download.STATE_REMOVING. |
void |
setStopReason(int stopReason) |
Sets the stop reason of the downloads in a terminal state (
Download.STATE_COMPLETED,
Download.STATE_FAILED). |
void |
setStopReason(String id,
int stopReason) |
Sets the stop reason of the download with the given ID in a terminal state (
Download.STATE_COMPLETED, Download.STATE_FAILED). |
getDownload, getDownloadsvoid putDownload(Download download) throws IOException
Download.
This method may be slow and shouldn't normally be called on the main thread.
download - The Download to be added.IOException - If an error occurs setting the state.void removeDownload(String id) throws IOException
This method may be slow and shouldn't normally be called on the main thread.
id - The ID of the download to remove.IOException - If an error occurs removing the state.void setDownloadingStatesToQueued()
throws IOException
Download.STATE_DOWNLOADING states to Download.STATE_QUEUED.
This method may be slow and shouldn't normally be called on the main thread.
IOException - If an error occurs updating the state.void setStatesToRemoving()
throws IOException
Download.STATE_REMOVING.
This method may be slow and shouldn't normally be called on the main thread.
IOException - If an error occurs updating the state.void setStopReason(int stopReason)
throws IOException
Download.STATE_COMPLETED,
Download.STATE_FAILED).
This method may be slow and shouldn't normally be called on the main thread.
stopReason - The stop reason.IOException - If an error occurs updating the state.void setStopReason(String id, int stopReason) throws IOException
Download.STATE_COMPLETED, Download.STATE_FAILED). Does nothing if a download with the
given ID does not exist, or if it's not in a terminal state.
This method may be slow and shouldn't normally be called on the main thread.
id - The ID of the download to update.stopReason - The stop reason.IOException - If an error occurs updating the state.