Class ByteArrayDataSink
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.ByteArrayDataSink
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.upstream.DataSink
DataSink.Factory
-
-
Constructor Summary
Constructors Constructor Description ByteArrayDataSink()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the sink.byte[]getData()Returns the data written to the sink since the last call toopen(DataSpec), or null ifopen(DataSpec)has never been called.voidopen(DataSpec dataSpec)Opens the sink to consume the specified data.voidwrite(byte[] buffer, int offset, int length)Consumes the provided data.
-
-
-
Method Detail
-
open
public void open(DataSpec dataSpec)
Description copied from interface:DataSinkOpens the sink to consume the specified data.Note: If an
IOExceptionis thrown, callers must still callDataSink.close()to ensure that any partial effects of the invocation are cleaned up.
-
close
public void close() throws IOExceptionDescription copied from interface:DataSinkCloses the sink.Note: This method must be called even if the corresponding call to
DataSink.open(DataSpec)threw anIOException. SeeDataSink.open(DataSpec)for more details.- Specified by:
closein interfaceDataSink- Throws:
IOException- If an error occurs closing the sink.
-
write
public void write(byte[] buffer, int offset, int length)Description copied from interface:DataSinkConsumes the provided data.
-
getData
@Nullable public byte[] getData()
Returns the data written to the sink since the last call toopen(DataSpec), or null ifopen(DataSpec)has never been called.
-
-