Example usage for java.nio DoubleBuffer isDirect

List of usage examples for java.nio DoubleBuffer isDirect

Introduction

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

    bb.put(98765);/*ww w. jav a 2 s.c om*/
    System.out.println(bb.isDirect());

}

From source file:Main.java

public static DoubleBuffer clone(final DoubleBuffer buf) {
    if (buf == null) {
        return null;
    }//from w  w w. j  a  v a 2 s.  c o m
    buf.rewind();

    final DoubleBuffer copy;
    if (buf.isDirect()) {
        copy = createDoubleBuffer(buf.limit());
    } else {
        copy = createDoubleBufferOnHeap(buf.limit());
    }
    copy.put(buf);

    return copy;
}

From source file:Main.java

public static DoubleBuffer clone(final DoubleBuffer buf) {
    if (buf == null) {
        return null;
    }/*from w  w w  .  j a va  2 s  .co  m*/
    buf.rewind();
    final DoubleBuffer copy;
    if (buf.isDirect()) {
        copy = createDoubleBuffer(buf.limit());
    } else {
        copy = createDoubleBufferOnHeap(buf.limit());
    }
    copy.put(buf);

    return copy;
}