Here you can find the source of getByteArrayFromBuffer(ByteBuffer byteBuf)
private static byte[] getByteArrayFromBuffer(ByteBuffer byteBuf)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { private static byte[] getByteArrayFromBuffer(ByteBuffer byteBuf) { byteBuf.flip();//w w w . j a va 2 s . c om byte[] row = new byte[byteBuf.limit()]; byteBuf.get(row); byteBuf.clear(); return row; } }