Example usage for java.nio IntBuffer isDirect

List of usage examples for java.nio IntBuffer isDirect

Introduction

In this page you can find the example usage for java.nio IntBuffer isDirect.

Prototype

public abstract boolean isDirect();

Source Link

Document

Indicates whether this buffer is direct.

Usage

From source file:Main.java

public static void main(String[] args) {
    IntBuffer bb = IntBuffer.allocate(10);
    bb.put(100);//from w  w  w.  j a v a  2  s  .c  o  m
    System.out.println(bb.isDirect());

}

From source file:Main.java

public static IntBuffer clone(final IntBuffer buf) {
    if (buf == null) {
        return null;
    }// ww w .  j  a  va  2s .co m
    buf.rewind();

    final IntBuffer copy;
    if (buf.isDirect()) {
        copy = createIntBuffer(buf.limit());
    } else {
        copy = createIntBufferOnHeap(buf.limit());
    }
    copy.put(buf);

    return copy;
}