Back to Exoplayer

DataSourceUtil (ExoPlayer library)

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

latest4.3 KB
Original Source

Package com.google.android.exoplayer2.upstream

Class DataSourceUtil


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classDataSourceUtilextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

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.

Utility methods for DataSource.

Method Summary

All Methods Static Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | static void | closeQuietly​(DataSource dataSource) | Deprecated.

Closes a DataSource, suppressing any IOException that may occur. | | static byte[] | readExactly​(DataSource dataSource, int length) | Deprecated.

Reads length bytes from the specified opened DataSource, and returns a byte array containing the read data. | | static byte[] | readToEnd​(DataSource dataSource) | Deprecated.

Reads data from the specified opened DataSource until it ends, and returns a byte array containing the read data. |

- 

Methods inherited from class java.lang.Object

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

Method Detail

- 

readToEnd

public static byte[] readToEnd​([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")dataSource)
                        throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")

Deprecated.

Reads data from the specified opened DataSource until it ends, and returns a byte array containing the read data. Parameters:dataSource - The source from which to read.Returns:The concatenation of all read data.Throws:IOException - If an error occurs reading from the source.

- 

readExactly

public static byte[] readExactly​([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")dataSource,
                                 int length)
                          throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")

Deprecated.

Reads length bytes from the specified opened DataSource, and returns a byte array containing the read data. Parameters:dataSource - The source from which to read.length - The number of bytes to read.Returns:The read data.Throws:IOException - If an error occurs reading from the source.IllegalStateException - If the end of the source was reached before length bytes could be read.

- 

closeQuietly

public static void closeQuietly​(@Nullable[DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")dataSource)

Deprecated.

Closes a DataSource, suppressing any IOException that may occur. Parameters:dataSource - The DataSource to close.