Here you can find the source of allocateDirect(int capacity)
Parameter | Description |
---|---|
capacity | capacity of the allocated ByteBuffer |
public static ByteBuffer allocateDirect(int capacity)
//package com.java2s; // are made available under the terms of the Eclipse Public License v1.0 import java.nio.ByteBuffer; public class Main { /** Allocate ByteBuffer in flush mode. * The position and limit will both be zero, indicating that the buffer is * empty and in flush mode./*from w w w.j a va2 s. c om*/ * @param capacity capacity of the allocated ByteBuffer * @return Buffer */ public static ByteBuffer allocateDirect(int capacity) { ByteBuffer buf = ByteBuffer.allocateDirect(capacity); buf.limit(0); return buf; } }