MessageSink
Provides a buffered output stream that writes sequence of WriteBuffer instances.
A Sink implementation has total control of the buffer memory so that it can reuse buffer memory, use buffer pools, or use memory-mapped files.
Value members
Abstract methods
Writes an external payload data.
Writes an external payload data.
Unlike int, int) method, the buffer is given - this BufferSink implementation gets ownership of the buffer and may modify contents of the buffer. Contents of this buffer won't be modified by the caller.
- Value parameters:
- buffer
the data to add
- length
the number of bytes to add
- offset
the start offset in the data
Allocates the next buffer for writing MessagePack data.
Allocates the next buffer for writing MessagePack data.
This method returns an WriteBuffer instance that has specified size of capacity at least.
When this method is called twice, the previously returned buffer is no longer used. This method may be called twice without call of writeBuffer in between. In this case, the buffer should be discarded without flushing it to the output.
- Value parameters:
- minimumSize
the minimum required buffer size to allocate
- Returns:
a Buffer instance with at least minimumSize bytes of capacity
Writes an external payload data. This method should follow semantics of OutputStream.
Writes an external payload data. This method should follow semantics of OutputStream.
- Value parameters:
- buffer
the data to write
- length
the number of bytes to write
- offset
the start offset in the data
Writes the previously allocated buffer(s).
Writes the previously allocated buffer(s).
This method should write the buffer previously returned from next method until specified number of bytes. Once the entire buffer contents is totally written to the sink, the buffer should not be used because a BufferSink implementation might reuse the buffer.
This method is not always called for each next call. In this case, the buffer should be discarded without flushing it to the output when the next next is called.
- Value parameters:
- length
the number of bytes to write