writeDirect
inline fun BytePacketBuilder.writeDirect(
size: Int,
block: (ByteBuffer) -> Unit
): Unit
Deprecated: Use write {} instead.
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 is 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)
inline fun Buffer.writeDirect(
size: Int = 1,
block: (ByteBuffer) -> Unit
): Int
Deprecated: Work with Memory instead.