In this tutorial, we will check whether this associated buffer is based on a byte array or not, and provides read/write access.
The java.nio.ByteBuffer class extends java.nio.Buffer class. It provides the following methods:
| Return type | Method | Description |
| static ByteBuffer | wrap(byte[] b) | The wrap() method create a byte buffer by wrapping the associated byte array. |
| abstract boolean | hasArray() | The hasArray() method check associated buffer is based on byte array or not. |
import java.nio.*;
|
| C:\>java BufferHasArray ByteBuffer is based on array |
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.