# ContentDataSource.ContentDataSourceException

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

*** ** * ** ***


```
public class ContentDataSource.ContentDataSourceException extends DataSourceException
```

<br />

|---|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||||
| ↳ | [kotlin.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) |||||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception.html) ||||
|   |   | ↳ | [java.io.IOException](https://developer.android.com/reference/java/io/IOException.html) |||
|   |   |   | ↳ | [androidx.media3.datasource.DataSourceException](https://developer.android.com/reference/androidx/media3/datasource/DataSourceException) ||
|   |   |   |   | ↳ | [androidx.media3.datasource.ContentDataSource.ContentDataSourceException](https://developer.android.com/reference/androidx/media3/datasource/ContentDataSource.ContentDataSourceException) |

*** ** * ** ***

Thrown when an `https://developer.android.com/reference/java/io/IOException.html` is encountered reading from a content URI.

## Summary

| ### Public constructors |
|---|
| `[ContentDataSourceException](https://developer.android.com/reference/androidx/media3/datasource/ContentDataSource.ContentDataSourceException#ContentDataSourceException(java.io.IOException))(https://developer.android.com/reference/java/io/IOException.html cause)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/datasource/ContentDataSource.ContentDataSourceException#ContentDataSourceException(java.io.IOException,int)`. <br /> |
| `https://developer.android.com/reference/androidx/media3/datasource/ContentDataSource.ContentDataSourceException#ContentDataSourceException(java.io.IOException,int)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/io/IOException.html cause, @https://developer.android.com/reference/androidx/media3/common/PlaybackException.ErrorCode int errorCode )` Creates a new instance. |

### Inherited Constants

From [androidx.media3.datasource.DataSourceException](https://developer.android.com/reference/androidx/media3/datasource/DataSourceException) `static final int` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/androidx/media3/datasource/DataSourceException#POSITION_OUT_OF_RANGE() = 2008`

**This field is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/PlaybackException#ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE()`.

<br />

### Inherited fields

From [androidx.media3.datasource.DataSourceException](https://developer.android.com/reference/androidx/media3/datasource/DataSourceException) `final int` `@https://developer.android.com/reference/androidx/media3/common/PlaybackException.ErrorCode
https://developer.android.com/reference/androidx/media3/datasource/DataSourceException#reason()`

The reason of this `https://developer.android.com/reference/androidx/media3/datasource/DataSourceException`, should be one of the `ERROR_CODE_IO_*` in `https://developer.android.com/reference/androidx/media3/common/PlaybackException.ErrorCode`.

### Inherited methods

From [androidx.media3.datasource.DataSourceException](https://developer.android.com/reference/androidx/media3/datasource/DataSourceException) `static boolean` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/androidx/media3/datasource/DataSourceException#isCausedByPositionOutOfRange(java.io.IOException)(https://developer.android.com/reference/java/io/IOException.html e)`

Returns whether the given `https://developer.android.com/reference/java/io/IOException.html` was caused by a `https://developer.android.com/reference/androidx/media3/datasource/DataSourceException` whose `https://developer.android.com/reference/androidx/media3/datasource/DataSourceException#reason()` is `https://developer.android.com/reference/androidx/media3/common/PlaybackException#ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE()` in its cause stack.
From [java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) `synchronized final void` `https://developer.android.com/reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable.html exception)` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#fillInStackTrace()()` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#getCause()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#getLocalizedMessage()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#getMessage()()` `StackTraceElement[]` `https://developer.android.com/reference/java/lang/Throwable.html#getStackTrace()()` `synchronized final Throwable[]` `https://developer.android.com/reference/java/lang/Throwable.html#getSuppressed()()` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#initCause(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable.html cause)` `void` `https://developer.android.com/reference/java/lang/Throwable.html#printStackTrace()()` `void` `https://developer.android.com/reference/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement[])(StackTraceElement[] stackTrace)` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#toString()()`

## Public constructors

### ContentDataSourceException

```
public [ContentDataSourceException](https://developer.android.com/reference/androidx/media3/datasource/ContentDataSource.ContentDataSourceException#ContentDataSourceException(java.io.IOException))(IOException cause)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/datasource/ContentDataSource.ContentDataSourceException#ContentDataSourceException(java.io.IOException,int)`.

### ContentDataSourceException

```
public ContentDataSourceException(
    @Nullable IOException cause,
    @PlaybackException.ErrorCode int errorCode
)
```

Creates a new instance.