Example usage for java.nio DoubleBuffer limit

List of usage examples for java.nio DoubleBuffer limit

Introduction

In this page you can find the example usage for java.nio DoubleBuffer limit.

Prototype

public final int limit() 

Source Link

Document

Returns the limit of this buffer.

Usage

From source file:Main.java

public static DoubleBuffer createDoubleBuffer(DoubleBuffer buf, final int size) {
    if (buf != null && buf.limit() == size) {
        buf.rewind();/*from ww w  .  j a v  a 2 s.  c o m*/
        return buf;
    }

    buf = createDoubleBuffer(size);
    return buf;
}

From source file:Main.java

public static DoubleBuffer clone(final DoubleBuffer buf) {
    if (buf == null) {
        return null;
    }//from  w  w  w.  j av  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;
    }//w  ww. ja 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;
}