Interface WritableDownloadIndex
-
- All Superinterfaces:
DownloadIndex
- All Known Implementing Classes:
DefaultDownloadIndex
@WorkerThread public interface WritableDownloadIndex extends DownloadIndex
A writable index ofDownloads.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidputDownload(Download download)Adds or replaces aDownload.voidremoveDownload(String id)Removes the download with the given ID.voidsetDownloadingStatesToQueued()Sets allDownload.STATE_DOWNLOADINGstates toDownload.STATE_QUEUED.voidsetStatesToRemoving()Sets all states toDownload.STATE_REMOVING.voidsetStopReason(int stopReason)Sets the stop reason of the downloads in a terminal state (Download.STATE_COMPLETED,Download.STATE_FAILED).voidsetStopReason(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).-
Methods inherited from interface com.google.android.exoplayer2.offline.DownloadIndex
getDownload, getDownloads
-
-
-
-
Method Detail
-
putDownload
void putDownload(Download download) throws IOException
Adds or replaces aDownload.This method may be slow and shouldn't normally be called on the main thread.
- Parameters:
download- TheDownloadto be added.- Throws:
IOException- If an error occurs setting the state.
-
removeDownload
void removeDownload(String id) throws IOException
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:
id- The ID of the download to remove.- Throws:
IOException- If an error occurs removing the state.
-
setDownloadingStatesToQueued
void setDownloadingStatesToQueued() throws IOExceptionSets allDownload.STATE_DOWNLOADINGstates toDownload.STATE_QUEUED.This method may be slow and shouldn't normally be called on the main thread.
- Throws:
IOException- If an error occurs updating the state.
-
setStatesToRemoving
void setStatesToRemoving() throws IOExceptionSets all states toDownload.STATE_REMOVING.This method may be slow and shouldn't normally be called on the main thread.
- Throws:
IOException- If an error occurs updating the state.
-
setStopReason
void setStopReason(int stopReason) throws IOExceptionSets the stop reason of the downloads in a terminal state (Download.STATE_COMPLETED,Download.STATE_FAILED).This method may be slow and shouldn't normally be called on the main thread.
- Parameters:
stopReason- The stop reason.- Throws:
IOException- If an error occurs updating the state.
-
setStopReason
void setStopReason(String id, int stopReason) throws IOException
Sets the stop reason of the download with the given ID in a terminal state (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.
- Parameters:
id- The ID of the download to update.stopReason- The stop reason.- Throws:
IOException- If an error occurs updating the state.
-
-