Here you can find the source of ByteBufferToByteArray(ByteBuffer byteBuffer)
Parameter | Description |
---|---|
byteBuffer | ByteBuffer |
public static byte[] ByteBufferToByteArray(ByteBuffer byteBuffer)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { /**/*from w w w. ja va 2 s .com*/ * ByteBuffer to byte[] * * @param byteBuffer ByteBuffer * @return byte[] */ public static byte[] ByteBufferToByteArray(ByteBuffer byteBuffer) { // Read ByteBuffer into byte[] byteBuffer.rewind(); byte[] bytes = new byte[byteBuffer.remaining()]; byteBuffer.get(bytes); byteBuffer.rewind(); return bytes; } }