Class DataSourceUtil
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.DataSourceUtil
-
@Deprecated public final class DataSourceUtil extends Object
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 forDataSource
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
closeQuietly(DataSource dataSource)
Deprecated.Closes aDataSource
, suppressing anyIOException
that may occur.static byte[]
readExactly(DataSource dataSource, int length)
Deprecated.Readslength
bytes from the specified openedDataSource
, and returns a byte array containing the read data.static byte[]
readToEnd(DataSource dataSource)
Deprecated.Reads data from the specified openedDataSource
until it ends, and returns a byte array containing the read data.
-
-
-
Method Detail
-
readToEnd
public static byte[] readToEnd(DataSource dataSource) throws IOException
Deprecated.Reads data from the specified openedDataSource
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, int length) throws IOException
Deprecated.Readslength
bytes from the specified openedDataSource
, 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 beforelength
bytes could be read.
-
closeQuietly
public static void closeQuietly(@Nullable DataSource dataSource)
Deprecated.Closes aDataSource
, suppressing anyIOException
that may occur.- Parameters:
dataSource
- TheDataSource
to close.
-
-