docs/doc/reference/com/google/android/exoplayer2/upstream/ByteArrayDataSink.html
Package com.google.android.exoplayer2.upstream
All Implemented Interfaces:DataSink
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classByteArrayDataSinkextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[DataSink](DataSink.html "interface in com.google.android.exoplayer2.upstream")
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 DataSink for writing to a byte array.
-
DataSink.Factory
Constructors | Constructor | Description |
| --- | --- |
| ByteArrayDataSink() |
Deprecated.
|
All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | close() |
Deprecated.
Closes the sink.
|
| byte[] | getData() |
Deprecated.
Returns the data written to the sink since the last call to open(DataSpec), or null if open(DataSpec) has never been called.
|
| 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. |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public ByteArrayDataSink()
Deprecated.
-
public void open([DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec)
Deprecated.
Description copied from interface: DataSink
Opens the sink to consume the specified data.
Note: If an IOException is thrown, callers must still call DataSink.close() to ensure that any partial effects of the invocation are cleaned up.
Specified by:open in interface DataSinkParameters:dataSpec - Defines the data to be consumed.
-
public void close()
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Description copied from interface: DataSink
Closes the sink.
Note: This method must be called even if the corresponding call to DataSink.open(DataSpec) threw an IOException. See DataSink.open(DataSpec) for more details.
Specified by:close in interface DataSinkThrows:IOException - If an error occurs closing the sink.
-
public void write(byte[] buffer,
int offset,
int length)
Deprecated.
Description copied from interface: DataSink
Consumes the provided data.
Specified by:write in interface DataSinkParameters: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.
-
@Nullable
public byte[] getData()
Deprecated.
Returns the data written to the sink since the last call to open(DataSpec), or null if open(DataSpec) has never been called.