Back to Exoplayer

DataSourceInputStream (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/upstream/DataSourceInputStream.html

latest5.5 KB
Original Source

Package com.google.android.exoplayer2.upstream

Class DataSourceInputStream


[@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.

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 underlying DataSource. | | 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

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

DataSourceInputStream

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.

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](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.

- 

read

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

- 

read

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

- 

read

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

- 

close

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