public class

HttpDataSource.HttpDataSourceException

extends DataSourceException

 java.lang.Object

↳java.lang.Throwable

↳java.lang.Exception

↳java.io.IOException

androidx.media3.datasource.DataSourceException

↳androidx.media3.datasource.HttpDataSource.HttpDataSourceException

Subclasses:

HttpDataSource.CleartextNotPermittedException, HttpDataSource.InvalidContentTypeException, HttpDataSource.InvalidResponseCodeException, CronetDataSource.OpenException

Overview

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

Summary

Fields
public final DataSpecdataSpec

The DataSpec associated with the current connection.

public final inttype

public static final intTYPE_CLOSE

The error occurred in closing a HttpDataSource.

public static final intTYPE_OPEN

The error occurred reading data from a HttpDataSource.

public static final intTYPE_READ

The error occurred in opening a HttpDataSource.

from DataSourceExceptionPOSITION_OUT_OF_RANGE, reason
Constructors
publicHttpDataSourceException(DataSpec dataSpec, int type)

publicHttpDataSourceException(DataSpec dataSpec, int errorCode, int type)

Constructs an HttpDataSourceException.

publicHttpDataSourceException(java.io.IOException cause, DataSpec dataSpec, int type)

publicHttpDataSourceException(java.io.IOException cause, DataSpec dataSpec, int errorCode, int type)

Constructs an HttpDataSourceException.

publicHttpDataSourceException(java.lang.String message, DataSpec dataSpec, int type)

publicHttpDataSourceException(java.lang.String message, DataSpec dataSpec, int errorCode, int type)

Constructs an HttpDataSourceException.

publicHttpDataSourceException(java.lang.String message, java.io.IOException cause, DataSpec dataSpec, int type)

publicHttpDataSourceException(java.lang.String message, java.io.IOException cause, DataSpec dataSpec, int errorCode, int type)

Constructs an HttpDataSourceException.

Methods
public static HttpDataSource.HttpDataSourceExceptioncreateForIOException(java.io.IOException cause, DataSpec dataSpec, int type)

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

from DataSourceExceptionisCausedByPositionOutOfRange
from java.lang.ThrowableaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Fields

public static final int TYPE_OPEN

The error occurred reading data from a HttpDataSource.

public static final int TYPE_READ

The error occurred in opening a HttpDataSource.

public static final int TYPE_CLOSE

The error occurred in closing a HttpDataSource.

public final DataSpec dataSpec

The DataSpec associated with the current connection.

public final int type

Constructors

public HttpDataSourceException(DataSpec dataSpec, int type)

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

public HttpDataSourceException(DataSpec dataSpec, int errorCode, int type)

Constructs an HttpDataSourceException.

Parameters:

dataSpec: The DataSpec.
errorCode: Reason of the error, should be one of the ERROR_CODE_IO_* in .
type: See HttpDataSource.HttpDataSourceException.Type.

public HttpDataSourceException(java.lang.String message, DataSpec dataSpec, int type)

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

public HttpDataSourceException(java.lang.String message, DataSpec dataSpec, int errorCode, int type)

Constructs an HttpDataSourceException.

Parameters:

message: The error message.
dataSpec: The DataSpec.
errorCode: Reason of the error, should be one of the ERROR_CODE_IO_* in .
type: See HttpDataSource.HttpDataSourceException.Type.

public HttpDataSourceException(java.io.IOException cause, DataSpec dataSpec, int type)

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

public HttpDataSourceException(java.io.IOException cause, DataSpec dataSpec, int errorCode, int type)

Constructs an HttpDataSourceException.

Parameters:

cause: The error cause.
dataSpec: The DataSpec.
errorCode: Reason of the error, should be one of the ERROR_CODE_IO_* in .
type: See HttpDataSource.HttpDataSourceException.Type.

public HttpDataSourceException(java.lang.String message, java.io.IOException cause, DataSpec dataSpec, int type)

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

public HttpDataSourceException(java.lang.String message, java.io.IOException cause, DataSpec dataSpec, int errorCode, int type)

Constructs an HttpDataSourceException.

Parameters:

message: The error message.
cause: The error cause.
dataSpec: The DataSpec.
errorCode: Reason of the error, should be one of the ERROR_CODE_IO_* in .
type: See HttpDataSource.HttpDataSourceException.Type.

Methods

public static HttpDataSource.HttpDataSourceException createForIOException(java.io.IOException cause, DataSpec dataSpec, int type)

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