Example usage for java.nio IntBuffer put

List of usage examples for java.nio IntBuffer put

Introduction

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

Prototype

public IntBuffer put(IntBuffer src) 

Source Link

Document

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

Usage

From source file:Main.java

public static void main(String[] args) {
    IntBuffer bb = IntBuffer.allocate(10);
    bb.put(100);

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

    int[] intArray = new int[10];
    bb.get(intArray, 0, 2);

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

}

From source file:Main.java

public static void main(String[] args) {
    IntBuffer bb = IntBuffer.allocate(10);
    bb.put(100);

    bb.rewind();/*from ww w.j ava2  s.  c om*/

    IntBuffer intBuffer2 = IntBuffer.allocate(10);

    intBuffer2.put(bb);

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

}

From source file:Main.java

public static void main(String[] args) {
    IntBuffer intBuffer = IntBuffer.allocate(10);
    intBuffer.put(100);

    intBuffer.rewind();// www .ja v  a  2  s .  co  m

    IntBuffer intBuffer2 = intBuffer.asReadOnlyBuffer();

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

}

From source file:Main.java

public static void main(String[] args) {
    IntBuffer intBuffer = IntBuffer.allocate(10);
    intBuffer.put(100);

    intBuffer.rewind();/*from  w w w  .  ja v  a2s  . co  m*/

    IntBuffer intBuffer2 = intBuffer.duplicate();

    System.out.println(intBuffer2.equals(intBuffer2));

}

From source file:Main.java

public static void main(String[] args) {
    IntBuffer intBuffer = IntBuffer.allocate(10);
    intBuffer.put(100);

    intBuffer.rewind();/*  ww w.ja v a2s  .  co  m*/

    IntBuffer intBuffer2 = intBuffer.compact();

    System.out.println(intBuffer2.compareTo(intBuffer2));

}

From source file:Main.java

public static void main(String[] args) {
    IntBuffer intBuffer = IntBuffer.allocate(10);
    intBuffer.put(100);

    intBuffer.rewind();//  www .  j  a  va 2 s  . co m

    IntBuffer intBuffer2 = intBuffer.slice();

    System.out.println(intBuffer2.equals(intBuffer2));

}

From source file:Main.java

public static void main(String[] args) {
    IntBuffer intBuffer = IntBuffer.allocate(10);
    intBuffer.put(100);

    intBuffer.rewind();//  w  w w.  j av  a  2s  . c  om

    IntBuffer intBuffer2 = intBuffer.compact();

    System.out.println(intBuffer2.equals(intBuffer2));

}

From source file:MainClass.java

public static void main(String[] args) {
    ByteBuffer bb = ByteBuffer.allocate(BSIZE);
    IntBuffer ib = bb.asIntBuffer();

    ib.put(new int[] { 1, 2, 7, 9, 3, 8, 6 });

    System.out.println(ib.get(3));
    ib.put(3, 1811);//from  w  w  w .  j a v a  2  s.c  o  m
    ib.rewind();
    while (ib.hasRemaining()) {
        int i = ib.get();
        if (i == 0)
            break; // Else we'll get the entire buffer
        System.out.println(i);
    }
}

From source file:Main.java

public static void main(String[] args) {
    IntBuffer bb = IntBuffer.wrap(new int[] { 0, 1, 2, 3, 4, 5, 6 });
    bb.put(100);
    System.out.println(Arrays.toString(bb.array()));

}

From source file:Main.java

public static void main(String[] args) {
    IntBuffer bb = IntBuffer.wrap(new int[] { 0, 1, 2, 3, 4, 5, 6 }, 0, 3);
    bb.put(100);
    System.out.println(Arrays.toString(bb.array()));

}