@WorkerThread
@UnstableApi
public interface DownloadIndex

Known direct subclasses
WritableDownloadIndex

A writable index of Downloads.

Known indirect subclasses
DefaultDownloadIndex

A DownloadIndex that uses SQLite to persist Downloads.


An index of Downloads.

Summary

Public methods

abstract @Nullable Download

Returns the Download with the given id, or null.

abstract DownloadCursor

Returns a DownloadCursor to Downloads with the given states.

Public methods

getDownload

abstract @Nullable Download getDownload(String id)

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
String id

ID of a Download.

Returns
@Nullable Download

The Download with the given id, or null if a download state with this id doesn't exist.

Throws
java.io.IOException

If an error occurs reading the state.

getDownloads

abstract DownloadCursor getDownloads(@Download.State int[] states)

Returns a DownloadCursor to Downloads with the given states.

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

Parameters
@Download.State int[] states

Returns only the Downloads with this states. If empty, returns all.

Returns
DownloadCursor

A cursor to Downloads with the given states.

Throws
java.io.IOException

If an error occurs reading the state.