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 givenDataSpec
to be read from aDataSource
and 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 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 underlyingDataSource
.int
read()
Deprecated.int
read(byte[] buffer)
Deprecated.int
read(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
- TheDataSource
from which the data should be read.dataSpec
- TheDataSpec
defining 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 IOException
Deprecated.Optional call to open the underlyingDataSource
.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 underlyingDataSource
if it's not open already.- Throws:
IOException
- If an error occurs opening theDataSource
.
-
read
public int read() throws IOException
Deprecated.- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] buffer) throws IOException
Deprecated.- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] buffer, int offset, int length) throws IOException
Deprecated.- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
public void close() throws IOException
Deprecated.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
-