HttpDataSource.HttpDataSourceException


public class HttpDataSource.HttpDataSourceException extends DataSourceException

Known direct 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.


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

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation HttpDataSource.HttpDataSourceException.Type

The type of operation that produced the error.

Constants

static final int

The error occurred in closing a HttpDataSource.

static final int

The error occurred reading data from a HttpDataSource.

static final int

The error occurred in opening a HttpDataSource.

Public fields

final DataSpec

The DataSpec associated with the current connection.

final int

Public constructors

This method is deprecated.

Use HttpDataSourceException(DataSpec, PlaybackException.ERROR_CODE_IO_UNSPECIFIED, int).

This method is deprecated.

Use HttpDataSourceException(IOException, DataSpec, PlaybackException.ERROR_CODE_IO_UNSPECIFIED, int).

Constructs an HttpDataSourceException.

This method is deprecated.

Use HttpDataSourceException(String, DataSpec, PlaybackException.ERROR_CODE_IO_UNSPECIFIED, int).

@UnstableApi
HttpDataSourceException(
    IOException cause,
    DataSpec dataSpec,
    @PlaybackException.ErrorCode int errorCode,
    @HttpDataSource.HttpDataSourceException.Type int type
)

Constructs an HttpDataSourceException.

@UnstableApi
HttpDataSourceException(
    String message,
    IOException cause,
    DataSpec dataSpec,
    @HttpDataSource.HttpDataSourceException.Type int type
)

This method is deprecated.

Use HttpDataSourceException(String, IOException, DataSpec, PlaybackException.ERROR_CODE_IO_UNSPECIFIED, int).

@UnstableApi
HttpDataSourceException(
    String message,
    DataSpec dataSpec,
    @PlaybackException.ErrorCode int errorCode,
    @HttpDataSource.HttpDataSourceException.Type int type
)

Constructs an HttpDataSourceException.

@UnstableApi
HttpDataSourceException(
    String message,
    @Nullable IOException cause,
    DataSpec dataSpec,
    @PlaybackException.ErrorCode int errorCode,
    @HttpDataSource.HttpDataSourceException.Type int type
)

Constructs an HttpDataSourceException.

Public methods

static HttpDataSource.HttpDataSourceException

Returns a HttpDataSourceException whose error code is assigned according to the cause and type.

Inherited Constants

From androidx.media3.datasource.DataSourceException
static final int

This field is deprecated.

Use ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE.

Inherited fields

From androidx.media3.datasource.DataSourceException
final int

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

Inherited methods

From androidx.media3.datasource.DataSourceException
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.

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

TYPE_CLOSE

public static final int TYPE_CLOSE = 3

The error occurred in closing a HttpDataSource.

TYPE_OPEN

public static final int TYPE_OPEN = 1

The error occurred reading data from a HttpDataSource.

TYPE_READ

public static final int TYPE_READ = 2

The error occurred in opening a HttpDataSource.

Public fields

dataSpec

@UnstableApi
public final DataSpec dataSpec

The DataSpec associated with the current connection.

Public constructors

HttpDataSourceException

@UnstableApi
public HttpDataSourceException(
    DataSpec dataSpec,
    @PlaybackException.ErrorCode int errorCode,
    @HttpDataSource.HttpDataSourceException.Type int type
)

Constructs an HttpDataSourceException.

Parameters
DataSpec dataSpec

The DataSpec.

@PlaybackException.ErrorCode int errorCode

Reason of the error, should be one of the ERROR_CODE_IO_* in .

@HttpDataSource.HttpDataSourceException.Type int type

See Type.

HttpDataSourceException

@UnstableApi
public HttpDataSourceException(
    String message,
    DataSpec dataSpec,
    @HttpDataSource.HttpDataSourceException.Type int type
)

HttpDataSourceException

@UnstableApi
public HttpDataSourceException(
    IOException cause,
    DataSpec dataSpec,
    @PlaybackException.ErrorCode int errorCode,
    @HttpDataSource.HttpDataSourceException.Type int type
)

Constructs an HttpDataSourceException.

Parameters
IOException cause

The error cause.

DataSpec dataSpec

The DataSpec.

@PlaybackException.ErrorCode int errorCode

Reason of the error, should be one of the ERROR_CODE_IO_* in .

@HttpDataSource.HttpDataSourceException.Type int type

See Type.

HttpDataSourceException

@UnstableApi
public HttpDataSourceException(
    String message,
    IOException cause,
    DataSpec dataSpec,
    @HttpDataSource.HttpDataSourceException.Type int type
)

HttpDataSourceException

@UnstableApi
public HttpDataSourceException(
    String message,
    DataSpec dataSpec,
    @PlaybackException.ErrorCode int errorCode,
    @HttpDataSource.HttpDataSourceException.Type int type
)

Constructs an HttpDataSourceException.

Parameters
String message

The error message.

DataSpec dataSpec

The DataSpec.

@PlaybackException.ErrorCode int errorCode

Reason of the error, should be one of the ERROR_CODE_IO_* in .

@HttpDataSource.HttpDataSourceException.Type int type

See Type.

HttpDataSourceException

@UnstableApi
public HttpDataSourceException(
    String message,
    @Nullable IOException cause,
    DataSpec dataSpec,
    @PlaybackException.ErrorCode int errorCode,
    @HttpDataSource.HttpDataSourceException.Type int type
)

Constructs an HttpDataSourceException.

Parameters
String message

The error message.

@Nullable IOException cause

The error cause.

DataSpec dataSpec

The DataSpec.

@PlaybackException.ErrorCode int errorCode

Reason of the error, should be one of the ERROR_CODE_IO_* in .

@HttpDataSource.HttpDataSourceException.Type int type

See Type.

Public methods

createForIOException

@UnstableApi
public static HttpDataSource.HttpDataSourceException createForIOException(
    IOException cause,
    DataSpec dataSpec,
    @HttpDataSource.HttpDataSourceException.Type int type
)

Returns a HttpDataSourceException whose error code is assigned according to the cause and type.