# DownloadCursor

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadCursor "View this page in Java")

<br />

```
@UnstableApi
interface DownloadCursor : Closeable
```

<br />

*** ** * ** ***

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

## Summary

|                                           ### Public functions                                           |
|----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                            | [close](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#close())`()`                                                                                                                                                      |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                              | [getCount](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#getCount())`()` Returns the numbers of downloads in the cursor.                                                                                                |
| [Download](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/Download)`!` | [getDownload](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#getDownload())`()` Returns the download at the current position.                                                                                            |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                              | [getPosition](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#getPosition())`()` Returns the current position of the cursor in the download set.                                                                          |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                      | [isAfterLast](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#isAfterLast())`()` Returns whether the cursor is pointing to the position after the last download.                                                          |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                      | [isBeforeFirst](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#isBeforeFirst())`()` Returns whether the cursor is pointing to the position before the first download.                                                    |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                      | [isClosed](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#isClosed())`()` Returns whether the cursor is closed                                                                                                           |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                      | [isFirst](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#isFirst())`()` Returns whether the cursor is pointing to the first download.                                                                                    |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                      | [isLast](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#isLast())`()` Returns whether the cursor is pointing to the last download.                                                                                       |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                      | [moveToFirst](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#moveToFirst())`()` Move the cursor to the first download.                                                                                                   |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                      | [moveToLast](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#moveToLast())`()` Move the cursor to the last download.                                                                                                      |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                      | [moveToNext](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#moveToNext())`()` Move the cursor to the next download.                                                                                                      |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                      | [moveToPosition](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#moveToPosition(int))`(position: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Move the cursor to an absolute position. |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                      | [moveToPrevious](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadCursor#moveToPrevious())`()` Move the cursor to the previous download.                                                                                          |

## Public functions

### close

```
fun close(): Unit
```  

### getCount

```
fun getCount(): Int
```

Returns the numbers of downloads in the cursor.  

### getDownload

```
fun getDownload(): Download!
```

Returns the download at the current position.  

### getPosition

```
fun getPosition(): Int
```

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](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the current cursor position. |

### isAfterLast

```
fun isAfterLast(): Boolean
```

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

### isBeforeFirst

```
fun isBeforeFirst(): Boolean
```

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

### isClosed

```
fun isClosed(): Boolean
```

Returns whether the cursor is closed  

### isFirst

```
fun isFirst(): Boolean
```

Returns whether the cursor is pointing to the first download.  

### isLast

```
fun isLast(): Boolean
```

Returns whether the cursor is pointing to the last download.  

### moveToFirst

```
fun moveToFirst(): Boolean
```

Move the cursor to the first download.

This method will return false if the cursor is empty.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-----------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the move succeeded. |

### moveToLast

```
fun moveToLast(): Boolean
```

Move the cursor to the last download.

This method will return false if the cursor is empty.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-----------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the move succeeded. |

### moveToNext

```
fun moveToNext(): Boolean
```

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](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the move succeeded. |

### moveToPosition

```
fun moveToPosition(position: Int): Boolean
```

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                                        |
|-----------------------------------------------------------------------------------------|-------------------------------------|
| `position: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the zero-based position to move to. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|---------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the requested move fully succeeded. |

### moveToPrevious

```
fun moveToPrevious(): Boolean
```

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](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the move succeeded. |