Example usage for java.nio IntBuffer allocate

List of usage examples for java.nio IntBuffer allocate

Introduction

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

Prototype

public static IntBuffer allocate(int capacity) 

Source Link

Document

Creates an int buffer based on a newly allocated int array.

Usage

From source file:Main.java

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

    bb.rewind();
    System.out.println(bb.get(0));

}

From source file:Main.java

public static void main(String[] args) {
    IntBuffer bb = IntBuffer.allocate(10);
    bb.put(100);/*from  ww w. j ava2  s.  co m*/

    bb.rewind();

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

    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);//from  ww w.j a  va 2 s .  c o  m

    bb.rewind();

    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);/*w w w  .j  av  a  2s . c  om*/

    bb.rewind();

    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);/*  w  w w  . ja va  2 s  .  c om*/

    intBuffer.rewind();

    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);/* ww  w.  j a v  a 2 s.  c o  m*/

    intBuffer.rewind();

    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);//  ww w  .  jav a  2 s  .c  o  m

    intBuffer.rewind();

    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);/* w  ww  .ja v a2 s . c o  m*/

    intBuffer.rewind();

    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);/*from   w w  w.java  2s .co m*/

    intBuffer.rewind();

    IntBuffer intBuffer2 = intBuffer.compact();

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

}

From source file:org.jtrfp.trcl.gpu.GLShader.java

private void printStatusInfo(GL3 gl, int shaderID) {
    IntBuffer statBuf = IntBuffer.allocate(1);
    gl.glGetShaderiv(shaderID, GL4.GL_COMPILE_STATUS, statBuf);
    if (statBuf.get(0) == GL4.GL_FALSE) {
        statBuf.clear();/*  w w  w  .j a  va  2  s .  c  om*/
        gl.glGetShaderiv(shaderID, GL4.GL_INFO_LOG_LENGTH, statBuf);
        ByteBuffer log = ByteBuffer.allocate(statBuf.get(0));
        gl.glGetShaderInfoLog(shaderID, statBuf.get(0), null, log);
        System.out.println(Charset.forName("US-ASCII").decode(log).toString());
        System.exit(1);
    }
}