docs/doc/reference/com/google/android/exoplayer2/offline/DefaultDownloadIndex.html
Package com.google.android.exoplayer2.offline
All Implemented Interfaces:DownloadIndex, WritableDownloadIndex
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classDefaultDownloadIndexextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[WritableDownloadIndex](WritableDownloadIndex.html "interface in com.google.android.exoplayer2.offline")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
A DownloadIndex that uses SQLite to persist Downloads.
Constructors | Constructor | Description |
| --- | --- |
| DefaultDownloadIndex(DatabaseProvider databaseProvider) |
Deprecated.
Creates an instance that stores the Downloads in an SQLite database provided by a DatabaseProvider.
|
| DefaultDownloadIndex(DatabaseProvider databaseProvider, String name) |
Deprecated.
Creates an instance that stores the Downloads in an SQLite database provided by a DatabaseProvider.
|
All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| Download | getDownload(String id) |
Deprecated.
Returns the Download with the given id, or null.
|
| DownloadCursor | getDownloads(@com.google.android.exoplayer2.offline.Download.State int... states) |
Deprecated.
Returns a DownloadCursor to Downloads with the given states.
|
| void | putDownload(Download download) |
Deprecated.
Adds or replaces a Download.
|
| void | removeDownload(String id) |
Deprecated.
Removes the download with the given ID.
|
| void | setDownloadingStatesToQueued() |
Deprecated.
Sets all Download.STATE_DOWNLOADING states to Download.STATE_QUEUED.
|
| void | setStatesToRemoving() |
Deprecated.
Sets all states to Download.STATE_REMOVING.
|
| void | setStopReason(int stopReason) |
Deprecated.
Sets the stop reason of the downloads in a terminal state (Download.STATE_COMPLETED, Download.STATE_FAILED).
|
| void | setStopReason(String id, int stopReason) |
Deprecated.
Sets the stop reason of the download with the given ID in a terminal state (Download.STATE_COMPLETED, Download.STATE_FAILED).
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public DefaultDownloadIndex([DatabaseProvider](../database/DatabaseProvider.html "interface in com.google.android.exoplayer2.database")databaseProvider)
Deprecated.
Creates an instance that stores the Downloads in an SQLite database provided by a DatabaseProvider.
Equivalent to calling DefaultDownloadIndex(DatabaseProvider, String) with name="".
Applications that only have one download index may use this constructor. Applications that have multiple download indices should call DefaultDownloadIndex(DatabaseProvider, String) to specify a unique name for each index.
Parameters:databaseProvider - Provides the SQLite database in which downloads are persisted.
-
public DefaultDownloadIndex([DatabaseProvider](../database/DatabaseProvider.html "interface in com.google.android.exoplayer2.database")databaseProvider,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")name)
Deprecated.
Creates an instance that stores the Downloads in an SQLite database provided by a DatabaseProvider.
Parameters:databaseProvider - Provides the SQLite database in which downloads are persisted.name - The name of the index. This name is incorporated into the names of the SQLite tables in which downloads are persisted.
-
@Nullable
public[Download](Download.html "class in com.google.android.exoplayer2.offline")getDownload([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")id)
throws[DatabaseIOException](../database/DatabaseIOException.html "class in com.google.android.exoplayer2.database")
Deprecated.
Description copied from interface: DownloadIndex
Returns the Download with the given id, or null.
This method may be slow and shouldn't normally be called on the main thread.
Specified by:getDownload in interface DownloadIndexParameters:id - ID of a Download.Returns:The Download with the given id, or null if a download state with this id doesn't exist.Throws:DatabaseIOException
-
public[DownloadCursor](DownloadCursor.html "interface in com.google.android.exoplayer2.offline")getDownloads([@State](Download.State.html "annotation in com.google.android.exoplayer2.offline")@com.google.android.exoplayer2.offline.Download.State int... states)
throws[DatabaseIOException](../database/DatabaseIOException.html "class in com.google.android.exoplayer2.database")
Deprecated.
Description copied from interface: DownloadIndex
Returns a DownloadCursor to Downloads with the given states.
This method may be slow and shouldn't normally be called on the main thread.
Specified by:getDownloads in interface DownloadIndexParameters:states - Returns only the Downloads with this states. If empty, returns all.Returns:A cursor to Downloads with the given states.Throws:DatabaseIOException
-
public void putDownload([Download](Download.html "class in com.google.android.exoplayer2.offline")download)
throws[DatabaseIOException](../database/DatabaseIOException.html "class in com.google.android.exoplayer2.database")
Deprecated.
Description copied from interface: WritableDownloadIndex
Adds or replaces a Download.
This method may be slow and shouldn't normally be called on the main thread.
Specified by:putDownload in interface WritableDownloadIndexParameters:download - The Download to be added.Throws:DatabaseIOException
-
public void removeDownload([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")id)
throws[DatabaseIOException](../database/DatabaseIOException.html "class in com.google.android.exoplayer2.database")
Deprecated.
Description copied from interface: WritableDownloadIndex
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.
Specified by:removeDownload in interface WritableDownloadIndexParameters:id - The ID of the download to remove.Throws:DatabaseIOException
-
public void setDownloadingStatesToQueued()
throws[DatabaseIOException](../database/DatabaseIOException.html "class in com.google.android.exoplayer2.database")
Deprecated.
Description copied from interface: WritableDownloadIndex
Sets all Download.STATE_DOWNLOADING states to Download.STATE_QUEUED.
This method may be slow and shouldn't normally be called on the main thread.
Specified by:setDownloadingStatesToQueued in interface WritableDownloadIndexThrows:DatabaseIOException
-
public void setStatesToRemoving()
throws[DatabaseIOException](../database/DatabaseIOException.html "class in com.google.android.exoplayer2.database")
Deprecated.
Description copied from interface: WritableDownloadIndex
Sets all states to Download.STATE_REMOVING.
This method may be slow and shouldn't normally be called on the main thread.
Specified by:setStatesToRemoving in interface WritableDownloadIndexThrows:DatabaseIOException
-
public void setStopReason(int stopReason)
throws[DatabaseIOException](../database/DatabaseIOException.html "class in com.google.android.exoplayer2.database")
Deprecated.
Description copied from interface: WritableDownloadIndex
Sets 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.
Specified by:setStopReason in interface WritableDownloadIndexParameters:stopReason - The stop reason.Throws:DatabaseIOException
-
public void setStopReason([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")id,
int stopReason)
throws[DatabaseIOException](../database/DatabaseIOException.html "class in com.google.android.exoplayer2.database")
Deprecated.
Description copied from interface: WritableDownloadIndex
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.
Specified by:setStopReason in interface WritableDownloadIndexParameters:id - The ID of the download to update.stopReason - The stop reason.Throws:DatabaseIOException