Example usage for java.nio LongBuffer allocate

List of usage examples for java.nio LongBuffer allocate

Introduction

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

Prototype

public static LongBuffer allocate(int capacity) 

Source Link

Document

Creates a long buffer based on a newly allocated long array.

Usage

From source file:Main.java

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

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

}

From source file:Main.java

public static void main(String[] args) {
    LongBuffer bb = LongBuffer.allocate(10);
    bb.put(100);//from   www.  j  a  v a2s. c  o  m

    bb.rewind();

    long[] longArray = new long[10];
    bb.get(longArray, 0, 2);

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

}

From source file:Main.java

public static void main(String[] args) {
    LongBuffer bb = LongBuffer.allocate(10);
    bb.put(100);//from   ww  w  .j  a  va 2 s .  c om

    bb.rewind();

    long[] longArray = new long[10];
    bb.get(longArray);

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

}

From source file:Main.java

public static void main(String[] args) {
    LongBuffer bb = LongBuffer.allocate(10);
    bb.put(100L);/*from   www.j ava  2 s.c  om*/

    bb.rewind();

    LongBuffer longBuffer2 = LongBuffer.allocate(10);

    longBuffer2.put(bb);

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

}

From source file:Main.java

public static void main(String[] args) {
    LongBuffer longBuffer = LongBuffer.allocate(10);
    longBuffer.put(100);//from   w w w.j av  a 2s.c  o m

    longBuffer.rewind();

    LongBuffer longBuffer2 = longBuffer.compact();

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

}

From source file:Main.java

public static void main(String[] args) {
    LongBuffer longBuffer = LongBuffer.allocate(10);
    longBuffer.put(100);/* w w  w  .  j av  a2s .  com*/

    longBuffer.rewind();

    LongBuffer longBuffer2 = longBuffer.asReadOnlyBuffer();

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

}

From source file:Main.java

public static void main(String[] args) {
    LongBuffer longBuffer = LongBuffer.allocate(10);
    longBuffer.put(100);//www . ja v  a 2  s .c  om

    longBuffer.rewind();

    LongBuffer longBuffer2 = longBuffer.compact();

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

}

From source file:Main.java

public static void main(String[] args) {
    LongBuffer longBuffer = LongBuffer.allocate(10);
    longBuffer.put(100);//from w w  w  . j  a va  2 s.  c o m

    longBuffer.rewind();

    LongBuffer longBuffer2 = longBuffer.slice();

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

}

From source file:Main.java

public static void main(String[] args) {
    LongBuffer longBuffer = LongBuffer.allocate(10);
    longBuffer.put(100);//from   w  w w.  j  ava  2s .c o  m

    longBuffer.rewind();

    LongBuffer longBuffer2 = longBuffer.duplicate();

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

}

From source file:org.libimobiledevice.ios.driver.binding.services.ScreenshotService.java

private byte[] takeScreenshotAsTiff() throws SDKException {

    PointerByReference ptr = new PointerByReference();
    LongBuffer sizeptr = LongBuffer.allocate(1);

    int res = screenshot_service_take_screenshot(service, ptr, sizeptr);

    if (ptr == null) {
        throw new SDKException("Bug ? pointer should have been assigned by the screenshot service");
    } else if (ptr.getValue() == null) {
        throw new SDKException("Didn't get a value back. Something wrong in screenshot_service");
    } else {//w  ww  . jav  a 2  s .  c  om
        long size = sizeptr.get(0);
        byte[] b = ptr.getValue().getByteArray(0, (int) size);
        return b;
    }
}