Example usage for java.nio FloatBuffer isDirect

List of usage examples for java.nio FloatBuffer isDirect

Introduction

In this page you can find the example usage for java.nio FloatBuffer 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) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);

    floatBuffer.put(1, 1.23F);//from w w  w  .  ja  v a  2  s .  c o m

    System.out.println(floatBuffer.isDirect());

}

From source file:Main.java

public static FloatBuffer clone(final FloatBuffer buf) {
    if (buf == null) {
        return null;
    }/*from w ww.j  a v  a  2 s.com*/
    buf.rewind();

    final FloatBuffer copy;
    if (buf.isDirect()) {
        copy = createFloatBuffer(buf.limit());
    } else {
        copy = createFloatBufferOnHeap(buf.limit());
    }
    copy.put(buf);

    return copy;
}

From source file:Main.java

public static FloatBuffer clone(final FloatBuffer buf) {
    if (buf == null) {
        return null;
    }// w w w  .  j a va  2  s .c  o m
    buf.rewind();
    final FloatBuffer copy;
    if (buf.isDirect()) {
        copy = createFloatBuffer(buf.limit());
    } else {
        copy = createFloatBufferOnHeap(buf.limit());
    }
    copy.put(buf);

    return copy;
}