In this tutorial, we will see how to represent the state of short buffer in the form of string.
ShortBuffer API:
The java.nio.ShortBuffer class extends java.nio.Buffer class. It provides the following methods:
| Return type | Method | Description |
| static ShortBuffer | allocate( int capacity) | The allocate(..) method allocate a short buffer of given capacity. |
| abstract ShortBuffer | toString() | The toString() method returns a string that summarizing the state of buffer. |
import java.nio.*;
|
| C:\>java StateString Position of short buffer : 2 Limit of short buffer : 1024 capacity of short buffer : 1024 String representation of state of short buffer : java.nio.HeapShortBuffer[pos=2 lim=1024 cap=1024] |
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.