List of utility methods to do ShortBuffer Create
void | copy(short[] src, ShortBuffer dst, int numShorts, int offset) copy dst.clear(); dst.limit(numShorts); dst.put(src, offset, numShorts); dst.flip(); |
ShortBuffer | newShortBuffer(int numShorts) new Short Buffer ByteBuffer buffer = ByteBuffer.allocateDirect(numShorts * 2);
buffer.order(ByteOrder.nativeOrder());
return buffer.asShortBuffer();
|
ShortBuffer | newShortBuffer(int numShorts) new Short Buffer ByteBuffer buffer = ByteBuffer.allocateDirect(numShorts * 2);
buffer.order(ByteOrder.nativeOrder());
return buffer.asShortBuffer();
|
ShortBuffer | createShortBuffer(int capacity) Creates a ShortBuffer with the specified capacity. return createByteBuffer(capacity * 2).asShortBuffer();
|
ShortBuffer | createShortBuffer(int shortCount) create Short Buffer ByteBuffer data = ByteBuffer.allocateDirect(shortCount * 4);
data.order(ByteOrder.nativeOrder());
ShortBuffer p1 = data.asShortBuffer();
return p1;
|
ShortBuffer | createShortBuffer(int size) create Short Buffer ByteBuffer bf = ByteBuffer.allocateDirect(size * 2);
return bf.order(ByteOrder.nativeOrder()).asShortBuffer();
|
ShortBuffer | createShortBuffer(int size) create Short Buffer ByteBuffer bb = ByteBuffer.allocateDirect(size * 2);
bb.order(ByteOrder.nativeOrder());
return bb.asShortBuffer();
|
ShortBuffer | createShortBuffer(short[] data) Creates a ShortBuffer from the specified short array. ShortBuffer b = createShortBuffer(data.length);
b.put(data);
b.rewind();
return b;
|
ShortBuffer | createShortBuffer(short[] shortData) create Short Buffer ShortBuffer buffer = ByteBuffer
.allocateDirect(shortData.length * BYTES_PER_SHORT)
.order(ByteOrder.nativeOrder()).asShortBuffer()
.put(shortData);
buffer.position(0);
return buffer;
|
ShortBuffer | createShortIndicesBuffer( final int capacity) create Short Indices Buffer final ShortBuffer indices = createDirectShortBuffer(capacity); fillIndices(indices, 0, capacity); return indices; |