# DownloadCursor

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/offline/DownloadCursor.java+class:androidx.media3.exoplayer.offline.DownloadCursor)

*** ** * ** ***


```
@UnstableApi
public interface DownloadCursor extends Closeable
```

<br />

*** ** * ** ***

Provides random read-write access to the result set returned by a database query.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#close()()` |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#getCount()()` Returns the numbers of downloads in the cursor. |
| `abstract https://developer.android.com/reference/androidx/media3/exoplayer/offline/Download` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#getDownload()()` Returns the download at the current position. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#getPosition()()` Returns the current position of the cursor in the download set. |
| `default boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#isAfterLast()()` Returns whether the cursor is pointing to the position after the last download. |
| `default boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#isBeforeFirst()()` Returns whether the cursor is pointing to the position before the first download. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#isClosed()()` Returns whether the cursor is closed |
| `default boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#isFirst()()` Returns whether the cursor is pointing to the first download. |
| `default boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#isLast()()` Returns whether the cursor is pointing to the last download. |
| `default boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#moveToFirst()()` Move the cursor to the first download. |
| `default boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#moveToLast()()` Move the cursor to the last download. |
| `default boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#moveToNext()()` Move the cursor to the next download. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#moveToPosition(int)(int position)` Move the cursor to an absolute position. |
| `default boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor#moveToPrevious()()` Move the cursor to the previous download. |

## Public methods

### close

```
abstract void close()
```

### getCount

```
abstract int getCount()
```

Returns the numbers of downloads in the cursor.

### getDownload

```
abstract Download getDownload()
```

Returns the download at the current position.

### getPosition

```
abstract int getPosition()
```

Returns the current position of the cursor in the download set. The value is zero-based. When the download set is first returned the cursor will be at position -1, which is before the first download. After the last download is returned another call to next() will leave the cursor past the last entry, at a position of count().

| Returns |
|---|---|
| `int` | the current cursor position. |

### isAfterLast

```
default boolean isAfterLast()
```

Returns whether the cursor is pointing to the position after the last download.

### isBeforeFirst

```
default boolean isBeforeFirst()
```

Returns whether the cursor is pointing to the position before the first download.

### isClosed

```
abstract boolean isClosed()
```

Returns whether the cursor is closed

### isFirst

```
default boolean isFirst()
```

Returns whether the cursor is pointing to the first download.

### isLast

```
default boolean isLast()
```

Returns whether the cursor is pointing to the last download.

### moveToFirst

```
default boolean moveToFirst()
```

Move the cursor to the first download.

This method will return false if the cursor is empty.

| Returns |
|---|---|
| `boolean` | whether the move succeeded. |

### moveToLast

```
default boolean moveToLast()
```

Move the cursor to the last download.

This method will return false if the cursor is empty.

| Returns |
|---|---|
| `boolean` | whether the move succeeded. |

### moveToNext

```
default boolean moveToNext()
```

Move the cursor to the next download.

This method will return false if the cursor is already past the last entry in the result set.

| Returns |
|---|---|
| `boolean` | whether the move succeeded. |

### moveToPosition

```
abstract boolean moveToPosition(int position)
```

Move the cursor to an absolute position. The valid range of values is -1 \<= position \<= count.

This method will return true if the request destination was reachable, otherwise, it returns false.

| Parameters |
|---|---|
| `int position` | the zero-based position to move to. |

| Returns |
|---|---|
| `boolean` | whether the requested move fully succeeded. |

### moveToPrevious

```
default boolean moveToPrevious()
```

Move the cursor to the previous download.

This method will return false if the cursor is already before the first entry in the result set.

| Returns |
|---|---|
| `boolean` | whether the move succeeded. |