Package com.google.android.exoplayer2.offline

## Interface DownloadIndex

- All Known Subinterfaces:
    `WritableDownloadIndex`
  All Known Implementing Classes:
    `DefaultDownloadIndex`

      @WorkerThread
      public interface DownloadIndex

  An index of `Downloads`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Download` | `getDownload​(String id)` | Returns the `Download` with the given `id`, or null.
    `DownloadCursor` | `getDownloads​(@com.google.android.exoplayer2.offline.Download.State int... states)` | Returns a `DownloadCursor` to `Download`s with the given `states`.

- - ### Method Detail

    - #### getDownload

          @Nullable
          Download getDownload​(String id)
                        throws IOException

      Returns the `Download` with the given `id`, or null.

      This method may be slow and shouldn't normally be called on the main thread.

      Parameters:
        `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:
        `IOException` - If an error occurs reading the state.

    - #### getDownloads

          DownloadCursor getDownloads​(@State
                                      @com.google.android.exoplayer2.offline.Download.State int... states)
                               throws IOException

      Returns a `DownloadCursor` to `Download`s with the given `states`.

      This method may be slow and shouldn't normally be called on the main thread.

      Parameters:
        `states` - Returns only the `Download`s with this states. If empty, returns all.
      Returns:
        A cursor to `Download`s with the given `states`.
      Throws:
        `IOException` - If an error occurs reading the state.