docs/doc/reference/com/google/android/exoplayer2/upstream/DataSink.html
Package com.google.android.exoplayer2.upstream
AesCipherDataSink, ByteArrayDataSink, CacheDataSink, FailOnCloseDataSink[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceDataSink
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.
A component to which streams of data can be written.
Nested Classes | Modifier and Type | Interface | Description |
| --- | --- | --- |
| static interface | DataSink.Factory |
Deprecated.
A factory for DataSink instances.
|
All Methods Instance Methods Abstract Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | close() |
Deprecated.
Closes the sink.
|
| void | open(DataSpec dataSpec) |
Deprecated.
Opens the sink to consume the specified data.
|
| void | write(byte[] buffer, int offset, int length) |
Deprecated.
Consumes the provided data. |
-
void open([DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec)
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Opens the sink to consume the specified data.
Note: If an IOException is thrown, callers must still call close() to ensure that any partial effects of the invocation are cleaned up.
Parameters:dataSpec - Defines the data to be consumed.Throws:IOException - If an error occurs opening the sink.
-
void write(byte[] buffer,
int offset,
int length)
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Consumes the provided data.
Parameters:buffer - The buffer from which data should be consumed.offset - The offset of the data to consume in buffer.length - The length of the data to consume, in bytes.Throws:IOException - If an error occurs writing to the sink.
-
void close()
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Closes the sink.
Note: This method must be called even if the corresponding call to open(DataSpec) threw an IOException. See open(DataSpec) for more details.
Throws:IOException - If an error occurs closing the sink.