Android ByteBuffer Create makeByteBuffer(int size)

Here you can find the source of makeByteBuffer(int size)

Description

make Byte Buffer

Declaration

public static ByteBuffer makeByteBuffer(int size) 

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);//www . ja  v a 2 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(float [] arr)
  2. arr2ByteBuffer(float[] arr)
  3. list2ByteBuffer(List arr)
  4. list2ByteBuffer(List list)
  5. makeByteBuffer(byte[] arr)
  6. newByteBuffer(int numBytes)
  7. newByteBuffer(int paramInt)
  8. setupByteBuffer(ByteBuffer preBuffer, byte[] array)
  9. renewBuffer(ByteBuffer buf)