Example usage for java.nio DoubleBuffer put

List of usage examples for java.nio DoubleBuffer put

Introduction

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

Prototype

public DoubleBuffer put(DoubleBuffer src) 

Source Link

Document

Writes all the remaining doubles of the src double buffer to this buffer's current position, and increases both buffers' position by the number of doubles copied.

Usage

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);

    DoubleBuffer bb1 = bb.duplicate();

    System.out.println(Arrays.toString(bb1.array()));

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);

    DoubleBuffer bb1 = bb.asReadOnlyBuffer();

    System.out.println(bb1.toString());

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);

    DoubleBuffer bb1 = bb.compact();

    System.out.println(Arrays.toString(bb1.array()));

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);

    DoubleBuffer bb1 = bb.slice();

    System.out.println(Arrays.toString(bb1.array()));

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);

    DoubleBuffer bb1 = bb.compact();

    System.out.println(Arrays.toString(bb1.array()));

    System.out.println(bb.compareTo(bb1));

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);

    DoubleBuffer bb1 = DoubleBuffer.allocate(BSIZE);

    bb1.put(bb);//from  w w w  . j  a v  a 2 s . c  o m

    System.out.println(Arrays.toString(bb1.array()));

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);

    DoubleBuffer bb1 = DoubleBuffer.allocate(BSIZE);

    double[] doubleArray = new double[BSIZE];

    bb1.get(doubleArray);/*w w w. j  av  a  2s  .c o  m*/

    System.out.println(Arrays.toString(doubleArray));

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);
    bb.put(98765);
    bb.put(98765);//w  ww .j  av a2 s  .  c  o m
    bb.put(98765);
    bb.put(98765);
    bb.put(98765);

    bb.rewind();

    double[] doubleArray = new double[BSIZE];

    bb.get(doubleArray, 0, 2);

    System.out.println(Arrays.toString(doubleArray));

}

From source file:Main.java

public static DoubleBuffer clone(final DoubleBuffer buf) {
    if (buf == null) {
        return null;
    }/* ww  w .j  ava 2s .c om*/
    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;
    }/*ww w.ja va2s .  com*/
    buf.rewind();
    final DoubleBuffer copy;
    if (buf.isDirect()) {
        copy = createDoubleBuffer(buf.limit());
    } else {
        copy = createDoubleBufferOnHeap(buf.limit());
    }
    copy.put(buf);

    return copy;
}