writeByteBufferDirect

inline fun <Error class: unknown class>.writeByteBufferDirect(size: Int, block: (ByteBuffer) -> Unit): Int

Write bytes directly to packet builder's segment. Generally shouldn't be used in user's code and useful for efficient integration.

Invokes block lambda with one byte buffer. block lambda should change provided's position accordingly but shouldn't change any other pointers.

Parameters

size

minimal number of bytes should be available in a buffer provided to the lambda. Should be as small as possible. If size is too large then the function may fail because the segments size is not guaranteed to be fixed and not guaranteed that it will be big enough to keep size bytes. However it is guaranteed that the segment size is at least 8 bytes long (long integer bytes length)