Java ByteBuffer Allocate allocateBuffer(int size, boolean isDirect)

Here you can find the source of allocateBuffer(int size, boolean isDirect)

Description

allocate Buffer

License

Apache License

Declaration

public static ByteBuffer allocateBuffer(int size, boolean isDirect) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.ByteBuffer;

public class Main {
    public static ByteBuffer allocateBuffer(int size, boolean isDirect) {
        final ByteBuffer buffer;
        if (isDirect) {
            buffer = ByteBuffer.allocateDirect(size);
        } else {//from w ww  .  j a  v a  2 s .c  om
            buffer = ByteBuffer.allocate(size);
        }
        return buffer;
    }
}

Related

  1. allocate(int capacity, boolean direct)
  2. allocate(int length)
  3. allocate(int length, byte fillwith)
  4. allocate(int size)
  5. allocate(int size)
  6. allocateDirect(int capacity)
  7. allocateDirectBuffer(int size)
  8. allocateDirectInt(int size)
  9. allocateDoubles(final int howmany, final int SIZE)