directAllocateByteBuffer

Allocates a new direct (off-heap) ByteBuffer with a capacity equal to this Kapacity.

Direct buffers allocate memory outside of the standard JVM heap, bypassing standard garbage collection. They are highly optimized for native I/O operations (like socket or file channel transfers) and JNI interactions, as they avoid copying data between the JVM heap and native memory.

Note: Allocating and deallocating direct buffers is generally more expensive than standard buffers, so they are best suited for large, long-lived buffers.

Warning on Bounds: Like standard buffers, the maximum allowed size is safely truncated to Int.MAX_VALUE- 8 (approximately 2.14 GB) to prevent memory allocation crashes.

Return

A new, empty direct ByteBuffer ready for writing.