WritableDownloadIndex
@WorkerThread
@UnstableApi
public interface WritableDownloadIndex extends DownloadIndex
DefaultDownloadIndex |
A |
A writable index of Downloads.
Summary
Public methods |
|
|---|---|
abstract void |
putDownload(Download download)Adds or replaces a |
abstract void |
removeDownload(String id)Removes the download with the given ID. |
abstract void |
Sets all |
abstract void |
Sets all states to |
abstract void |
setStopReason(int stopReason)Sets the stop reason of the downloads in a terminal state ( |
abstract void |
setStopReason(String id, int stopReason)Sets the stop reason of the download with the given ID in a terminal state ( |
Inherited methods |
||||
|---|---|---|---|---|
|
Public methods
putDownload
abstract void putDownload(Download download)
Adds or replaces a Download.
This method may be slow and shouldn't normally be called on the main thread.
| Throws | |
|---|---|
java.io.IOException |
If an error occurs setting the state. |
removeDownload
abstract void removeDownload(String id)
Removes the download with the given ID. Does nothing if a download with the given ID does not exist.
This method may be slow and shouldn't normally be called on the main thread.
| Parameters | |
|---|---|
String id |
The ID of the download to remove. |
| Throws | |
|---|---|
java.io.IOException |
If an error occurs removing the state. |
setDownloadingStatesToQueued
abstract void setDownloadingStatesToQueued()
Sets all STATE_DOWNLOADING states to STATE_QUEUED.
This method may be slow and shouldn't normally be called on the main thread.
| Throws | |
|---|---|
java.io.IOException |
If an error occurs updating the state. |
setStatesToRemoving
abstract void setStatesToRemoving()
Sets all states to STATE_REMOVING.
This method may be slow and shouldn't normally be called on the main thread.
| Throws | |
|---|---|
java.io.IOException |
If an error occurs updating the state. |
setStopReason
abstract void setStopReason(int stopReason)
Sets the stop reason of the downloads in a terminal state (STATE_COMPLETED, STATE_FAILED).
This method may be slow and shouldn't normally be called on the main thread.
| Parameters | |
|---|---|
int stopReason |
The stop reason. |
| Throws | |
|---|---|
java.io.IOException |
If an error occurs updating the state. |
setStopReason
abstract void setStopReason(String id, int stopReason)
Sets the stop reason of the download with the given ID in a terminal state (STATE_COMPLETED, 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.
| Parameters | |
|---|---|
String id |
The ID of the download to update. |
int stopReason |
The stop reason. |
| Throws | |
|---|---|
java.io.IOException |
If an error occurs updating the state. |