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 void
close()
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.void
open(DataSpec dataSpec)
Opens the sink to consume the specified data.void
write(byte[] buffer, int offset, int length)
Consumes the provided data.
-
-
-
Method Detail
-
open
public void open(DataSpec dataSpec)
Description copied from interface:DataSink
Opens the sink to consume the specified data.Note: If an
IOException
is thrown, callers must still callDataSink.close()
to ensure that any partial effects of the invocation are cleaned up.
-
close
public void close() throws IOException
Description copied from interface:DataSink
Closes 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:
close
in interfaceDataSink
- Throws:
IOException
- If an error occurs closing the sink.
-
write
public void write(byte[] buffer, int offset, int length)
Description copied from interface:DataSink
Consumes 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.
-
-