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 ElementBufferallocate(int elementSize, int elemCount)Returns a non direct PointerBuffer in native order, having a backup arraystatic ElementBufferallocateDirect(int elementSize, int elemCount)Returns a direct PointerBuffer in native order, w/o backup arraystatic ElementBufferderefPointer(int elementSize, long aptr, int elemCount)static ElementBufferderefPointer(int elementSize, ByteBuffer ptrSrc, int ptrSrcByteOffset, int elemCount)ElementBufferget(int srcElemPos, byte[] dest, int destElemPos, int elemCount)Absolute get method.ElementBufferget(int srcElemPos, char[] dest, int destElemPos, int elemCount)Absolute get method.ElementBufferget(int srcElemPos, double[] dest, int destElemPos, int elemCount)Absolute get method.ElementBufferget(int srcElemPos, float[] dest, int destElemPos, int elemCount)Absolute get method.ElementBufferget(int srcElemPos, int[] dest, int destElemPos, int elemCount)Absolute get method.ElementBufferget(int srcElemPos, long[] dest, int destElemPos, int elemCount)Absolute get method.ElementBufferget(int srcElemPos, short[] dest, int destElemPos, int elemCount)Absolute get method.ByteBufferget(int srcElemPos, ByteBuffer destElemBytes)Absolute get method.ByteBufferget(int srcElemPos, ByteBuffer destElemBytes, int destElemPos, int elemCount)Absolute get method.ByteBufferget(ByteBuffer destElemBytes)Relative get method.ElementBufferget(ByteBuffer[] destElements, int destElemPos, int elemCount)Relative bulk get method.ByteBuffergetByteBuffer()Returns the ByteBuffer, i.e.ElementBufferput(byte[] src, int srcElemPos, int destElemPos, int elemCount)Absolute put method.ElementBufferput(char[] src, int srcElemPos, int destElemPos, int elemCount)Absolute put method.ElementBufferput(double[] src, int srcElemPos, int destElemPos, int elemCount)Absolute put method.ElementBufferput(float[] src, int srcElemPos, int destElemPos, int elemCount)Absolute put method.ElementBufferput(int[] src, int srcElemPos, int destElemPos, int elemCount)Absolute put method.ElementBufferput(int destElemPos, ByteBuffer srcElemBytes)Absolute put method.ElementBufferput(long[] src, int srcElemPos, int destElemPos, int elemCount)Absolute put method.ElementBufferput(short[] src, int srcElemPos, int destElemPos, int elemCount)Absolute put method.ElementBufferput(ElementBuffer src)Relative bulk get method.ElementBufferput(ByteBuffer srcElemBytes)Relative put method.ElementBufferput(ByteBuffer[] srcElements, int offset, int length)Relative bulk put method.ElementBufferput(ByteBuffer srcElemBytes, int srcElemPos, int destElemPos, int elemCount)Absolute put method.ByteBufferslice(int offset, int length)Returns a slice of this instance's ByteBuffer `[offset..offset+length)`, i.e.StringtoString()static ElementBufferwrap(int elementSize, ByteBuffer src)static ElementBufferwrap(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:NativeBufferRelative 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:
toStringin classAbstractBuffer<ElementBuffer>
-
-