DataSink.Factory
Constructor and Description |
---|
ByteArrayDataSink() |
Modifier and Type | Method and 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) throws IOException
DataSink
open
in interface DataSink
dataSpec
- Defines the data to be consumed.IOException
- If an error occurs opening the sink.public void close() throws IOException
DataSink
close
in interface DataSink
IOException
- If an error occurs closing the sink.public void write(byte[] buffer, int offset, int length) throws IOException
DataSink
write
in interface DataSink
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.IOException
- If an error occurs writing to the sink.public byte[] getData()
open(DataSpec)
, or null if
open(DataSpec)
has never been called.