DataSourceException
public class DataSourceException extends IOException
| java.lang.Object | ||||
| ↳ | kotlin.Throwable | |||
| ↳ | java.lang.Exception | |||
| ↳ | java.io.IOException | |||
| ↳ | androidx.media3.datasource.DataSourceException |
AssetDataSource.AssetDataSourceException |
Thrown when an |
ContentDataSource.ContentDataSourceException |
Thrown when an |
FileDataSource.FileDataSourceException |
Thrown when a |
HttpDataSource.HttpDataSourceException |
Thrown when an error is encountered when trying to read from a |
RawResourceDataSource.RawResourceDataSourceException |
Thrown when an |
UdpDataSource.UdpDataSourceException |
Thrown when an error is encountered when trying to read from a |
CronetDataSource.OpenException |
Thrown when an error is encountered when trying to open a |
HttpDataSource.CleartextNotPermittedException |
Thrown when cleartext HTTP traffic is not permitted. |
HttpDataSource.InvalidContentTypeException |
Thrown when the content type is invalid. |
HttpDataSource.InvalidResponseCodeException |
Thrown when an attempt to open a connection results in a response code not in the 2xx range. |
HttpEngineDataSource.OpenException |
Thrown when an error is encountered when trying to open a |
Used to specify reason of a DataSource error.
Summary
Constants |
|
|---|---|
static final int |
@UnstableApiThis field is deprecated. |
Public fields |
|
|---|---|
final int |
The reason of this |
Public constructors |
|---|
@UnstableApiConstructs a DataSourceException. |
@UnstableApiConstructs a DataSourceException. |
@UnstableApiConstructs a DataSourceException. |
@UnstableApiConstructs a DataSourceException. |
Public methods |
|
|---|---|
static boolean |
Returns whether the given |
Inherited methods |
|---|
Constants
POSITION_OUT_OF_RANGE
@UnstableApi
public static final int POSITION_OUT_OF_RANGE = 2008
Indicates that the starting position of the request was outside the bounds of the data.
Public fields
reason
@PlaybackException.ErrorCode
public final int reason
The reason of this DataSourceException, should be one of the ERROR_CODE_IO_* in PlaybackException.ErrorCode.
Public constructors
DataSourceException
@UnstableApi
public DataSourceException(@PlaybackException.ErrorCode int reason)
Constructs a DataSourceException.
| Parameters | |
|---|---|
@PlaybackException.ErrorCode int reason |
Reason of the error, should be one of the |
DataSourceException
@UnstableApi
public DataSourceException(
@Nullable Throwable cause,
@PlaybackException.ErrorCode int reason
)
Constructs a DataSourceException.
| Parameters | |
|---|---|
@Nullable Throwable cause |
The error cause. |
@PlaybackException.ErrorCode int reason |
Reason of the error, should be one of the |
DataSourceException
@UnstableApi
public DataSourceException(
@Nullable String message,
@PlaybackException.ErrorCode int reason
)
Constructs a DataSourceException.
| Parameters | |
|---|---|
@Nullable String message |
The error message. |
@PlaybackException.ErrorCode int reason |
Reason of the error, should be one of the |
DataSourceException
@UnstableApi
public DataSourceException(
@Nullable String message,
@Nullable Throwable cause,
@PlaybackException.ErrorCode int reason
)
Constructs a DataSourceException.
| Parameters | |
|---|---|
@Nullable String message |
The error message. |
@Nullable Throwable cause |
The error cause. |
@PlaybackException.ErrorCode int reason |
Reason of the error, should be one of the |
Public methods
isCausedByPositionOutOfRange
@UnstableApi
public static boolean isCausedByPositionOutOfRange(IOException e)
Returns whether the given IOException was caused by a DataSourceException whose reason is ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE in its cause stack.