In this tutorial you will see how to Create a ByteBuffer using Byte Array in java.
In this tutorial you will see how to Create a ByteBuffer using Byte Array in java.
In this tutorial, we will discuss how to creates a buffer using byte array. The ByteBuffer
class is a container for handling data.The ByteBuffer class is available in java.nio package.
The java.nio.ByteBuffer class extends java.nio.Buffer class. It provides the following methods:
Return type | Method | Description |
static ByteBuffer | wrap(byte array) | The wrap method create a byte buffer by wrapping the associated byte arrray. |
final int | capacity() | The capacity() method returns the capacity of associated buffer. |
import java.nio.*;
|
C:\>java ByteArrayBuffer
C:\Work\Bharat\load\ByteArrayBuffedr\bharat.txt Name of file :C:\Work\Bharat\load\ByteArrayBuffedr\bharat.txt Capacity of ByteArraytBuffer : 255 |