List of utility methods to do ByteBuffer Create
ByteBuffer | newByteBuffer(int numBytes) new Byte Buffer ByteBuffer buffer = ByteBuffer.allocateDirect(numBytes);
buffer.order(ByteOrder.nativeOrder());
return buffer;
|
ByteBuffer | newByteBuffer(int paramInt) new Byte Buffer ByteBuffer localByteBuffer = ByteBuffer.allocateDirect(paramInt);
localByteBuffer.order(ByteOrder.nativeOrder());
return localByteBuffer;
|
ByteBuffer | setupByteBuffer(ByteBuffer preBuffer, byte[] array) setup Byte Buffer if (preBuffer == null || preBuffer.capacity() < array.length) { preBuffer = createByteBuffer(array.length * 2); } else { preBuffer.clear(); preBuffer.put(array); preBuffer.position(0); return preBuffer; ... |
ByteBuffer | renewBuffer(ByteBuffer buf) renew Buffer buf.position(0);
buf.limit(buf.capacity());
return buf;
|
ByteBuffer | allocateAudioBuffer(int size) allocate Audio Buffer ByteBuffer bb = ByteBuffer.allocateDirect(size);
bb.order(ByteOrder.LITTLE_ENDIAN);
return bb;
|
ByteBuffer | makeByteBuffer(byte[] array) make Byte Buffer final int SIZE = Byte.SIZE / 8; ByteBuffer byteBuffer = ByteBuffer.allocateDirect(array.length * SIZE); byteBuffer.order(ByteOrder.nativeOrder()); byteBuffer.put(array); byteBuffer.position(0); return byteBuffer; |
ByteBuffer | ConvToByteBuffer(byte buf[]) Conv To Byte Buffer ByteBuffer ReturnBuffer = ByteBuffer.allocateDirect(buf.length);
ReturnBuffer.order(ByteOrder.nativeOrder());
ReturnBuffer.put(buf);
ReturnBuffer.position(0);
return ReturnBuffer;
|
ByteBuffer | ConvToByteBuffer(byte buf[]) Conv To Byte Buffer ByteBuffer ReturnBuffer = ByteBuffer.allocateDirect(buf.length);
ReturnBuffer.order(ByteOrder.nativeOrder());
ReturnBuffer.put(buf);
ReturnBuffer.position(0);
return ReturnBuffer;
|
ByteBuffer | makeByteBuffer(byte[] arr) Make a direct NIO ByteBuffer from an array of floats ByteBuffer bb = ByteBuffer.allocateDirect(arr.length);
bb.order(ByteOrder.nativeOrder());
bb.put(arr);
bb.position(0);
return bb;
|
ByteBuffer | makeByteBuffer(byte[] arr) Make a direct NIO ByteBuffer from an array of floats ByteBuffer bb = ByteBuffer.allocateDirect(arr.length);
bb.order(ByteOrder.nativeOrder());
bb.put(arr);
bb.position(0);
return bb;
|