DataSink
@UnstableApi
public interface DataSink
AesCipherDataSink |
A wrapping |
ByteArrayDataSink |
A |
CacheDataSink |
Writes data into a cache. |
FailOnCloseDataSink |
A |
A component to which streams of data can be written.
Summary
Nested types |
|---|
public interface DataSink.FactoryA factory for |
Public methods |
|
|---|---|
abstract void |
close()Closes the sink. |
abstract void |
Opens the sink to consume the specified data. |
abstract void |
write(byte[] buffer, int offset, int length)Consumes the provided data. |
Public methods
close
abstract void close()
Closes the sink.
Note: This method must be called even if the corresponding call to open threw an IOException. See open for more details.
| Throws | |
|---|---|
java.io.IOException |
If an error occurs closing the sink. |
open
abstract void open(DataSpec dataSpec)
Opens the sink to consume the specified data.
Note: If an IOException is thrown, callers must still call close to ensure that any partial effects of the invocation are cleaned up.
| Parameters | |
|---|---|
DataSpec dataSpec |
Defines the data to be consumed. |
| Throws | |
|---|---|
java.io.IOException |
If an error occurs opening the sink. |
write
abstract void write(byte[] buffer, int offset, int length)
Consumes the provided data.
| Parameters | |
|---|---|
byte[] buffer |
The buffer from which data should be consumed. |
int offset |
The offset of the data to consume in |
int length |
The length of the data to consume, in bytes. |
| Throws | |
|---|---|
java.io.IOException |
If an error occurs writing to the sink. |