Android ByteBuffer Create makeByteBuffer(byte[] arr)

Here you can find the source of makeByteBuffer(byte[] arr)

Description

make Byte Buffer

Declaration

public static ByteBuffer makeByteBuffer(byte[] arr) 

Method Source Code

//package com.java2s;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    public static ByteBuffer makeByteBuffer(byte[] arr) {
        ByteBuffer bb = ByteBuffer.allocateDirect(arr.length);
        bb.order(ByteOrder.nativeOrder());
        bb.put(arr);/*from  ww  w . ja  v a2 s  . c om*/
        bb.position(0);
        return bb;
    }

    public static ByteBuffer makeByteBuffer(int size) {
        ByteBuffer bb = ByteBuffer.allocateDirect(size);
        bb.position(0);
        return bb;
    }
}

Related

  1. arr2ByteBuffer(byte[] arr)
  2. arr2ByteBuffer(float [] arr)
  3. arr2ByteBuffer(float[] arr)
  4. list2ByteBuffer(List arr)
  5. list2ByteBuffer(List list)
  6. makeByteBuffer(int size)
  7. newByteBuffer(int numBytes)
  8. newByteBuffer(int paramInt)
  9. setupByteBuffer(ByteBuffer preBuffer, byte[] array)