In this tutorial, you will see use of remaining() method in short buffer.
In this tutorial, you will see use of remaining() method in short buffer.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 new short buffer. |
ShortBuffer | put(short [] array) | The put(..)method transfer the elements of a short array into short buffer. |
Buffer API:
The java.nio.Buffer class extends java.lang.Object class. It provides the following methods:
Return type | Method | Description |
final int | remaining() | The reset() method returns remaining elements in buffer. |
import java.nio.*; |
C:\>java ElementRemain Current position of buffer : 0 Current limit of buffer : 3 Remaining elements in short buffer : 3 New position of buffer : 1 New limit of buffer : 3 Remaining elements in short buffer : 2 |