Invoke block function with a temporary Buffer instance of the specified size in bytes. The provided instance shouldn't be captured and used outside of the block otherwise an undefined behaviour may occur including crash and/or data corruption.
inline fun <R> withBuffer(pool: ObjectPool<Buffer>, block: Buffer.() -> R): R
Content copied to clipboard
Invoke block function with a temporary Buffer instance taken from the specified pool. Depending on the pool it may be safe or unsafe to capture and use the provided buffer outside of the block. Usually it is always recommended to NOT capture an instance outside.