In this tutorial, we will discuss the use of get(byte[] array,int offset, int
length) method of byte
stream class.
The get(byte[] array,int offset, int
length) method transfer bytes from buffer into byte array.
About ByteBuffer API:
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 array. |
| ByteBuffer | get(byte dest,int offset, int length) | The get(.....) method transfer byte from associated buffer into byte array. |
import java.io.*; |
output
| C:\>java BufferTransfer Contents into buffer : bharat singh Contents into Array : bharat singh |