DataSourceException


public class DataSourceException extends IOException

Known direct subclasses
AssetDataSource.AssetDataSourceException

Thrown when an IOException is encountered reading a local asset.

ContentDataSource.ContentDataSourceException

Thrown when an IOException is encountered reading from a content URI.

FileDataSource.FileDataSourceException

Thrown when a FileDataSource encounters an error reading a file.

HttpDataSource.HttpDataSourceException

Thrown when an error is encountered when trying to read from a HttpDataSource.

RawResourceDataSource.RawResourceDataSourceException

Thrown when an IOException is encountered reading from a raw resource.

UdpDataSource.UdpDataSourceException

Thrown when an error is encountered when trying to read from a UdpDataSource.

Known indirect subclasses
CronetDataSource.OpenException

Thrown when an error is encountered when trying to open a CronetDataSource.

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 HttpEngineDataSource.


Used to specify reason of a DataSource error.

Summary

Constants

static final int

This field is deprecated.

Use ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE.

Public fields

final int

The reason of this DataSourceException, should be one of the ERROR_CODE_IO_* in PlaybackException.ErrorCode.

Public constructors

Constructs a DataSourceException.

Constructs a DataSourceException.

Constructs a DataSourceException.

@UnstableApi
DataSourceException(
    @Nullable String message,
    @Nullable Throwable cause,
    @PlaybackException.ErrorCode int reason
)

Constructs a DataSourceException.

Public methods

static boolean

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.

Inherited methods

From java.lang.Throwable
synchronized final void
synchronized Throwable
synchronized Throwable
String
String
StackTraceElement[]
synchronized final Throwable[]
synchronized Throwable
void
void
setStackTrace(StackTraceElement[] stackTrace)
String

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 ERROR_CODE_IO_* in .

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 ERROR_CODE_IO_* in .

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 ERROR_CODE_IO_* in .

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 ERROR_CODE_IO_* in .

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.