Here you can find the source of byteBufferToBytes(ByteBuffer buffer)
Parameter | Description |
---|---|
buffer | a parameter |
public static byte[] byteBufferToBytes(ByteBuffer buffer)
//package com.java2s; //License from project: LGPL import java.nio.ByteBuffer; import java.util.Arrays; public class Main { /**//from w w w .jav a 2s .c o m * @param buffer * @return */ public static byte[] byteBufferToBytes(ByteBuffer buffer) { final byte[] array = buffer.array(); final int arrayOffset = buffer.arrayOffset(); return Arrays.copyOfRange(array, arrayOffset + buffer.position(), arrayOffset + buffer.limit()); } }