DataSink.Factory| Constructor | Description |
|---|---|
ByteArrayDataSink() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Closes the sink.
|
byte[] |
getData() |
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) |
Opens the sink to consume the specified data.
|
void |
write(byte[] buffer,
int offset,
int length) |
Consumes the provided data.
|
public void open(DataSpec dataSpec)
DataSinkNote: If an IOException is thrown, callers must still call DataSink.close() to
ensure that any partial effects of the invocation are cleaned up.
public void close()
throws IOException
DataSinkNote: This method must be called even if the corresponding call to DataSink.open(DataSpec)
threw an IOException. See DataSink.open(DataSpec) for more details.
close in interface DataSinkIOException - If an error occurs closing the sink.public void write(byte[] buffer,
int offset,
int length)
DataSink@Nullable public byte[] getData()
open(DataSpec), or null if
open(DataSpec) has never been called.