7f9ed7dec7
Motivation: Slicing gives you a derived buffer. This is useful for sending along just the part of a buffer that has the relevant data, or to get a new buffer instance for the same data, but with independent read and write offsets. Modification: Add slice() methods to the Buf interface, and implement them for MemSegBuf. Buffer slices increments the reference count of the parent buffer, which prevents the parent from being send()-able. Slices are themselves also not send()-able. This is because send() involves ownership transfer, while slicing is like lending out mutable borrows. The send() capability returns to the parent buffer once all slices are closed. |
||
---|---|---|
.. | ||
io/netty/buffer/b2 |