| Start |
|---|
| Basic Usage - Creating a ByteBuffer There's two ways to create a If you have an already existing This would be a possibility for code that handles low-level networking interactions If you do not have an already existing If the code-path is extremely performance critical and you need direct system memory access, the |
| Basic Usage - Using DirectByteBuffer
We can allocate such ByteBuffer by calling: This operation will allocate 16 bytes of memory. The contents of direct buffers may reside outside of the normal garbage-collected heap. We can verify whether ByteBuffer is direct by calling: The main characteristics of It is recomended to use We have to be aware that if we try using Another use of direct byte buffer is interop through JNI. Since a direct byte buffer does not use a The JNI interface defines several functions to handle direct byte buffers: NIO Support (opens new window). |
| Basic Usage - Write Data to the Buffer Given a Both methods allow "chaining" calls. Given a sufficiently sized buffer one can accordingly do the following: which is equivalent to: Do note that the method operating on An additional note: The index given when using absolute Syntax
|
Read Article
https://develop.horje.com/learn/1434/reference