Java ByteBuffer Create allocateByteBuffer(final int bytes)

Here you can find the source of allocateByteBuffer(final int bytes)

Description

Allocates a new direct ByteBuffer with the specified size and returns it.

License

Open Source License

Parameter

Parameter Description
bytes The size of the new byte buffer.

Return

The allocated direct byte buffer.

Declaration

public static ByteBuffer allocateByteBuffer(final int bytes) 

Method Source Code


//package com.java2s;
/*/*from  w  w w  .j a v  a 2  s.com*/
 * Copyright 2013 Luca Longinotti <l@longi.li>
 * See LICENSE.md for licensing information.
 */

import java.nio.ByteBuffer;

public class Main {
    /**
     * Allocates a new direct {@link ByteBuffer} with the specified size and
     * returns it.
     * 
     * @param bytes
     *            The size of the new byte buffer.
     * @return The allocated direct byte buffer.
     */
    public static ByteBuffer allocateByteBuffer(final int bytes) {
        return ByteBuffer.allocateDirect(bytes);
    }
}

Related

  1. allocaleByteBuffer(int capacity, boolean direct)
  2. allocateByteBuffer(boolean useDirectBuffer, int bufSize)
  3. allocateByteBuffer(int capacity)
  4. createByteBuffer(byte... data)
  5. createByteBuffer(byte... values)
  6. createByteBuffer(byte[] data)