docs/doc/reference/com/google/android/exoplayer2/upstream/DataSourceInputStream.html
Package com.google.android.exoplayer2.upstream
All Implemented Interfaces:Closeable, AutoCloseable
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classDataSourceInputStreamextends[InputStream](https://developer.android.com/reference/java/io/InputStream.html "class or interface in java.io")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Allows data corresponding to a given DataSpec to be read from a DataSource and consumed through an InputStream.
Constructors | Constructor | Description |
| --- | --- |
| DataSourceInputStream(DataSource dataSource, DataSpec dataSpec) |
Deprecated.
|
All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| long | bytesRead() |
Deprecated.
Returns the total number of bytes that have been read or skipped.
|
| void | close() |
Deprecated.
|
| void | open() |
Deprecated.
Optional call to open the underlying DataSource.
|
| int | read() |
Deprecated.
|
| int | read(byte[] buffer) |
Deprecated.
|
| int | read(byte[] buffer, int offset, int length) |
Deprecated.
|
-
available, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public DataSourceInputStream([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")dataSource,[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec)
Deprecated.
Parameters:dataSource - The DataSource from which the data should be read.dataSpec - The DataSpec defining the data to be read from dataSource.
-
public long bytesRead()
Deprecated.
Returns the total number of bytes that have been read or skipped.
-
public void open()
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Optional call to open the underlying DataSource.
Calling this method does nothing if the DataSource is already open. Calling this method is optional, since the read and skip methods will automatically open the underlying DataSource if it's not open already.
Throws:IOException - If an error occurs opening the DataSource.
-
public int read()
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Specified by:read in class InputStreamThrows:IOException
-
public int read(byte[] buffer)
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Overrides:read in class InputStreamThrows:IOException
-
public int read(byte[] buffer,
int offset,
int length)
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Overrides:read in class InputStreamThrows:IOException
-
public void close()
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Specified by:close in interface AutoCloseableSpecified by:close in interface CloseableOverrides:close in class InputStreamThrows:IOException