Package com.jogamp.common.nio
Class ElementBuffer
- java.lang.Object
-
- com.jogamp.common.nio.AbstractBuffer<ElementBuffer>
-
- com.jogamp.common.nio.ElementBuffer
-
- All Implemented Interfaces:
NativeBuffer<ElementBuffer>
public class ElementBuffer extends AbstractBuffer<ElementBuffer>
Hardware independent container holding an array of linearly aligned elements, while itsAbstractBuffer.getDirectBufferAddress()
is-a pointer-type value, i.e. the element-array address.An instance maps an array of linearly aligned elements, represented as bytes.
-
-
Field Summary
-
Fields inherited from class com.jogamp.common.nio.AbstractBuffer
buffer, capacity, elementSize, limit, POINTER_SIZE, position
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ElementBuffer
allocate(int elementSize, int elemCount)
Returns a non direct PointerBuffer in native order, having a backup arraystatic ElementBuffer
allocateDirect(int elementSize, int elemCount)
Returns a direct PointerBuffer in native order, w/o backup arraystatic ElementBuffer
derefPointer(int elementSize, long aptr, int elemCount)
static ElementBuffer
derefPointer(int elementSize, ByteBuffer ptrSrc, int ptrSrcByteOffset, int elemCount)
ElementBuffer
get(int srcElemPos, byte[] dest, int destElemPos, int elemCount)
Absolute get method.ElementBuffer
get(int srcElemPos, char[] dest, int destElemPos, int elemCount)
Absolute get method.ElementBuffer
get(int srcElemPos, double[] dest, int destElemPos, int elemCount)
Absolute get method.ElementBuffer
get(int srcElemPos, float[] dest, int destElemPos, int elemCount)
Absolute get method.ElementBuffer
get(int srcElemPos, int[] dest, int destElemPos, int elemCount)
Absolute get method.ElementBuffer
get(int srcElemPos, long[] dest, int destElemPos, int elemCount)
Absolute get method.ElementBuffer
get(int srcElemPos, short[] dest, int destElemPos, int elemCount)
Absolute get method.ByteBuffer
get(int srcElemPos, ByteBuffer destElemBytes)
Absolute get method.ByteBuffer
get(int srcElemPos, ByteBuffer destElemBytes, int destElemPos, int elemCount)
Absolute get method.ByteBuffer
get(ByteBuffer destElemBytes)
Relative get method.ElementBuffer
get(ByteBuffer[] destElements, int destElemPos, int elemCount)
Relative bulk get method.ByteBuffer
getByteBuffer()
Returns the ByteBuffer, i.e.ElementBuffer
put(byte[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method.ElementBuffer
put(char[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method.ElementBuffer
put(double[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method.ElementBuffer
put(float[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method.ElementBuffer
put(int[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method.ElementBuffer
put(int destElemPos, ByteBuffer srcElemBytes)
Absolute put method.ElementBuffer
put(long[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method.ElementBuffer
put(short[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method.ElementBuffer
put(ElementBuffer src)
Relative bulk get method.ElementBuffer
put(ByteBuffer srcElemBytes)
Relative put method.ElementBuffer
put(ByteBuffer[] srcElements, int offset, int length)
Relative bulk put method.ElementBuffer
put(ByteBuffer srcElemBytes, int srcElemPos, int destElemPos, int elemCount)
Absolute put method.ByteBuffer
slice(int offset, int length)
Returns a slice of this instance's ByteBuffer `[offset..offset+length)`, i.e.String
toString()
static ElementBuffer
wrap(int elementSize, ByteBuffer src)
static ElementBuffer
wrap(int elementSize, ByteBuffer src, int srcByteOffset, int elemCount)
-
Methods inherited from class com.jogamp.common.nio.AbstractBuffer
array, arrayOffset, capacity, clear, elementSize, flip, getBuffer, getDirectBufferAddress, hasArray, hasRemaining, isDirect, limit, limit, position, position, remaining, rewind, storeDirectAddress, storeDirectAddress, toSubString
-
-
-
-
Method Detail
-
allocate
public static ElementBuffer allocate(int elementSize, int elemCount)
Returns a non direct PointerBuffer in native order, having a backup array
-
allocateDirect
public static ElementBuffer allocateDirect(int elementSize, int elemCount)
Returns a direct PointerBuffer in native order, w/o backup array
-
wrap
public static ElementBuffer wrap(int elementSize, ByteBuffer src)
-
wrap
public static ElementBuffer wrap(int elementSize, ByteBuffer src, int srcByteOffset, int elemCount)
-
derefPointer
public static ElementBuffer derefPointer(int elementSize, long aptr, int elemCount)
-
derefPointer
public static ElementBuffer derefPointer(int elementSize, ByteBuffer ptrSrc, int ptrSrcByteOffset, int elemCount)
-
put
public final ElementBuffer put(ElementBuffer src)
Description copied from interface:NativeBuffer
Relative bulk get method. Copy the source valuessrc[position .. capacity] [
to this buffer and increment the position bycapacity-position
.
-
getByteBuffer
public final ByteBuffer getByteBuffer()
Returns the ByteBuffer, i.e.AbstractBuffer.getBuffer()
w/o casting.
-
slice
public final ByteBuffer slice(int offset, int length)
Returns a slice of this instance's ByteBuffer `[offset..offset+length)`, i.e. referencing the underlying bytes.- Parameters:
offset
- starting element-index within this bufferlength
- element count- Returns:
- slice of this instance's ByteBuffer
-
get
public final ByteBuffer get(int srcElemPos, ByteBuffer destElemBytes, int destElemPos, int elemCount)
Absolute get method. Get element-bytes for `elemCount` elements from this buffer at `srcElemPos` into `destElemBytes` at the given element-index `destElemPos`
-
get
public final ByteBuffer get(int srcElemPos, ByteBuffer destElemBytes)
Absolute get method. Copy the element-bytes from this buffer at the given element-index `srcElemPos`, storing them into `destElemBytes`.
-
get
public final ByteBuffer get(ByteBuffer destElemBytes)
Relative get method. Copy the element-bytes at the current position and increment the position by one, storing the element-bytes into `destElemBytes`.
-
get
public final ElementBuffer get(ByteBuffer[] destElements, int destElemPos, int elemCount)
Relative bulk get method. Copy the element-bytes[ position .. position+elemCount [
to the destination array[ destElements[destElemPos] .. destElements[destElemPos+elemCount] [
and increment the position byelemCount
.
-
get
public final ElementBuffer get(int srcElemPos, byte[] dest, int destElemPos, int elemCount)
Absolute get method. Get byte-elements for `elemCount` elements from this buffer at `srcElemPos` into `dest` at the given element-index `destElemPos`
-
get
public final ElementBuffer get(int srcElemPos, short[] dest, int destElemPos, int elemCount)
Absolute get method. Get short-elements for `elemCount` elements from this buffer at `srcElemPos` into `dest` at the given element-index `destElemPos`
-
get
public final ElementBuffer get(int srcElemPos, char[] dest, int destElemPos, int elemCount)
Absolute get method. Get char-elements for `elemCount` elements from this buffer at `srcElemPos` into `dest` at the given element-index `destElemPos`
-
get
public final ElementBuffer get(int srcElemPos, int[] dest, int destElemPos, int elemCount)
Absolute get method. Get int-elements for `elemCount` elements from this buffer at `srcElemPos` into `dest` at the given element-index `destElemPos`
-
get
public final ElementBuffer get(int srcElemPos, float[] dest, int destElemPos, int elemCount)
Absolute get method. Get float-elements for `elemCount` elements from this buffer at `srcElemPos` into `dest` at the given element-index `destElemPos`
-
get
public final ElementBuffer get(int srcElemPos, long[] dest, int destElemPos, int elemCount)
Absolute get method. Get long-elements for `elemCount` elements from this buffer at `srcElemPos` into `dest` at the given element-index `destElemPos`
-
get
public final ElementBuffer get(int srcElemPos, double[] dest, int destElemPos, int elemCount)
Absolute get method. Get double-elements for `elemCount` elements from this buffer at `srcElemPos` into `dest` at the given element-index `destElemPos`
-
put
public final ElementBuffer put(ByteBuffer srcElemBytes, int srcElemPos, int destElemPos, int elemCount)
Absolute put method. Put element-bytes for `elemCount` elements from `srcElemBytes` at `srcElemPos` into this buffer at the given element-index `destElemPos`
-
put
public final ElementBuffer put(int destElemPos, ByteBuffer srcElemBytes)
Absolute put method. Put element-bytes from `srcElemBytes` into the given element-index `destElemPos`
-
put
public final ElementBuffer put(ByteBuffer srcElemBytes)
Relative put method. Put the element-bytes at the current position and increment the position by one.
-
put
public final ElementBuffer put(ByteBuffer[] srcElements, int offset, int length)
Relative bulk put method. Put the element-bytes[ srcElements[offset] .. srcElements[offset+length] [
at the current position and increment the position bylength
.
-
put
public final ElementBuffer put(byte[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method. Put byte-elements for `elemCount` elements from `src` at `srcElemPos` into this buffer at the given element-index `destElemPos`
-
put
public final ElementBuffer put(short[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method. Put short-elements for `elemCount` elements from `src` at `srcElemPos` into this buffer at the given element-index `destElemPos`
-
put
public final ElementBuffer put(char[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method. Put char-elements for `elemCount` elements from `src` at `srcElemPos` into this buffer at the given element-index `destElemPos`
-
put
public final ElementBuffer put(int[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method. Put int-elements for `elemCount` elements from `src` at `srcElemPos` into this buffer at the given element-index `destElemPos`
-
put
public final ElementBuffer put(float[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method. Put float-elements for `elemCount` elements from `src` at `srcElemPos` into this buffer at the given element-index `destElemPos`
-
put
public final ElementBuffer put(long[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method. Put long-elements for `elemCount` elements from `src` at `srcElemPos` into this buffer at the given element-index `destElemPos`
-
put
public final ElementBuffer put(double[] src, int srcElemPos, int destElemPos, int elemCount)
Absolute put method. Put double-elements for `elemCount` elements from `src` at `srcElemPos` into this buffer at the given element-index `destElemPos`
-
toString
public String toString()
- Overrides:
toString
in classAbstractBuffer<ElementBuffer>
-
-