In this tutorial, you will see how to clean a short buffer by using clear method.
In this tutorial, you will see how to clean a short buffer by using clear method.In this tutorial, we will discuss how to clean a short buffer by using clear method.
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 | put(short s) | The put(..)method write a given short value at current position. |
Buffer API:
The java.nio.Buffer class extends java.lang.Object class. It provides the following methods:
Return type | Method | Description |
final Buffer | clear() | The clear() method clear the buffer. |
Int | remaining() | The remaining() method returns remaining element in buffer. |
import java.nio.*;
|
C:\>java ClearShortBuff Short data in a short buffer. 2354 666 6677 Number of remaining elements in short buffer : 0 Clear. |