Class DataSourceInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.google.android.exoplayer2.upstream.DataSourceInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
@Deprecated public final class DataSourceInputStream extends InputStream
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 givenDataSpecto be read from aDataSourceand consumed through anInputStream.
-
-
Constructor Summary
Constructors Constructor Description DataSourceInputStream(DataSource dataSource, DataSpec dataSpec)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description longbytesRead()Deprecated.Returns the total number of bytes that have been read or skipped.voidclose()Deprecated.voidopen()Deprecated.Optional call to open the underlyingDataSource.intread()Deprecated.intread(byte[] buffer)Deprecated.intread(byte[] buffer, int offset, int length)Deprecated.-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
DataSourceInputStream
public DataSourceInputStream(DataSource dataSource, DataSpec dataSpec)
Deprecated.- Parameters:
dataSource- TheDataSourcefrom which the data should be read.dataSpec- TheDataSpecdefining the data to be read fromdataSource.
-
-
Method Detail
-
bytesRead
public long bytesRead()
Deprecated.Returns the total number of bytes that have been read or skipped.
-
open
public void open() throws IOExceptionDeprecated.Optional call to open the underlyingDataSource.Calling this method does nothing if the
DataSourceis already open. Calling this method is optional, since the read and skip methods will automatically open the underlyingDataSourceif it's not open already.- Throws:
IOException- If an error occurs opening theDataSource.
-
read
public int read() throws IOExceptionDeprecated.- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] buffer) throws IOExceptionDeprecated.- Overrides:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] buffer, int offset, int length) throws IOExceptionDeprecated.- Overrides:
readin classInputStream- Throws:
IOException
-
close
public void close() throws IOExceptionDeprecated.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
-