Interface FlushSink
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Sink that receives buffered bytes when an
OStream's buffer fills (or
when OStream.flush() is called).
This is a functional interface, so a sink can be written as a lambda or a
method reference — for example out::write for an
OutputStream. Implementing it lets a message larger than the
output buffer (or larger than RAM) be streamed out incrementally: the encoder
hands the sink each full buffer and then resumes at the start of the buffer.
-
Method Summary
Modifier and TypeMethodDescriptionvoidflush(byte[] data, int offset, int length) Consumelengthbytes starting atoffsetindata.
-
Method Details
-
flush
Consumelengthbytes starting atoffsetindata.The array is owned by the encoder and is reused after this call returns; a sink that needs to retain the bytes must copy them.
- Parameters:
data- the encoder's active bufferoffset- start of the pending byteslength- number of pending bytes- Throws:
IOException- if the underlying transport or storage fails
-