Java ByteBuffer Allocate allocate(int capacity)

Here you can find the source of allocate(int capacity)

Description

allocate

License

Open Source License

Parameter

Parameter Description
capacity a parameter

Declaration

public static ByteBuffer allocate(int capacity) 

Method Source Code

//package com.java2s;
/*//from   w  w  w .  j  av  a 2s.  co  m
 * $Id$
 *
 * Copyright (C) 2003-2015 JNode.org
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; If not, write to the Free Software Foundation, Inc., 
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    /**
     * {@link ByteOrder} used in VMware disk.
     */
    public static final ByteOrder BYTE_ORDER = ByteOrder.LITTLE_ENDIAN;

    /**
     * 
     * @param capacity
     * @return
     */
    public static ByteBuffer allocate(int capacity) {
        ByteBuffer bb = ByteBuffer.allocate(capacity);
        bb.order(BYTE_ORDER);
        return bb;
    }
}

Related

  1. allocate(int capacity, boolean direct)
  2. allocate(int length)
  3. allocate(int length, byte fillwith)
  4. allocate(int size)