List of usage examples for java.nio ByteOrder nativeOrder
public static ByteOrder nativeOrder()
From source file:Main.java
public static ShortBuffer createShortBufferOnHeap(final int size) { final ShortBuffer buf = ByteBuffer.allocate(2 * size).order(ByteOrder.nativeOrder()).asShortBuffer(); buf.clear();/* w w w . j a va2 s . c o m*/ return buf; }
From source file:Main.java
public static DoubleBuffer createDoubleBufferOnHeap(final int size) { final DoubleBuffer buf = ByteBuffer.allocate(8 * size).order(ByteOrder.nativeOrder()).asDoubleBuffer(); buf.clear();// w ww . j a va2 s .c o m return buf; }
From source file:Main.java
public static ByteBuffer makeByteBuffer(byte[] array) { final int SIZE = Byte.SIZE / 8; ByteBuffer byteBuffer = ByteBuffer.allocateDirect(array.length * SIZE); byteBuffer.order(ByteOrder.nativeOrder()); byteBuffer.put(array);/*from w w w . j a v a 2 s. c o m*/ byteBuffer.position(0); return byteBuffer; }
From source file:Main.java
public static ShortBuffer createShortBuffer(final int size) { final ShortBuffer buf = ByteBuffer.allocateDirect(2 * size).order(ByteOrder.nativeOrder()).asShortBuffer(); buf.clear();//from w w w . j av a 2s .com return buf; }
From source file:Main.java
public static ByteBuffer newByteBuffer(int numBytes) { ByteBuffer buffer = ByteBuffer.allocateDirect(numBytes); buffer.order(ByteOrder.nativeOrder()); return buffer; }
From source file:Main.java
public static IntBuffer createIntBufferOnHeap(final int size) { final IntBuffer buf = ByteBuffer.allocate(SIZEOF_FLOAT * size).order(ByteOrder.nativeOrder()).asIntBuffer(); buf.clear();//from ww w .j a v a 2s .c o m return buf; }
From source file:Main.java
public static FloatBuffer makeFloatBuffer(int length) { final int floatSize = Float.SIZE / 8; ByteBuffer byteBuffer = ByteBuffer.allocateDirect(length * floatSize); byteBuffer.order(ByteOrder.nativeOrder()); FloatBuffer floatBuffer = byteBuffer.asFloatBuffer(); floatBuffer.position(0);//from ww w. j a v a 2 s. c o m return floatBuffer; }
From source file:Main.java
public static FloatBuffer createFloatBufferOnHeap(final int size) { final FloatBuffer buf = ByteBuffer.allocate(SIZEOF_FLOAT * size).order(ByteOrder.nativeOrder()) .asFloatBuffer();/*from ww w .j a v a2 s . co m*/ buf.clear(); return buf; }
From source file:Main.java
public static IntBuffer newIntBuffer(int numInts) { ByteBuffer buffer = ByteBuffer.allocateDirect(numInts * 4); buffer.order(ByteOrder.nativeOrder()); return buffer.asIntBuffer(); }
From source file:Main.java
public static CharBuffer newCharBuffer(int numChars) { ByteBuffer buffer = ByteBuffer.allocateDirect(numChars * 2); buffer.order(ByteOrder.nativeOrder()); return buffer.asCharBuffer(); }