In this tutorial, we will check short buffer is direct or not. If direct memory is allocated their memory address is fixed for the lifetime of the buffer.
ShortBuffer API:
The java.nio.ShortBuffer class extends java.nio.Buffer class. It provides the following methods:
| Return type | Method | Description |
| static ShortBuffer | wrap(short[] array) | The wrap(...) method create a short buffer by wrapping the associated short array. |
| abstract boolean | isDirect() | The isDirect() method tells whether this associated buffer is direct or not. |
import java.nio.*;
|
| C:\>java DirectShortBuffer Short buffer is not direct. Short buffer is direct. |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.