GlueGen: com.jogamp.common.nio.Buffers Class Reference

GlueGen v2.6.0-rc-20250722 GlueGen, Native Binding Generator for Java™ (public API).

Classes | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
com.jogamp.common.nio.Buffers Class Reference

Utility methods allowing easy `java.nio.Buffer` manipulations. More...

Collaboration diagram for com.jogamp.common.nio.Buffers:

## Classes

class | Cleaner
| Access to NIO `sun.misc.Cleaner`, allowing caller to deterministically clean a given `sun.nio.ch.DirectBuffer`. More...

## Static Public Member Functions

static ByteBuffer | newDirectByteBuffer (final int numElements)
| Allocates a new direct ByteBuffer with the specified number of elements. More...
static ByteBuffer | newDirectByteBuffer (final byte[] values, final int offset, final int length)
static ByteBuffer | newDirectByteBuffer (final byte[] values, final int offset)
static ByteBuffer | newDirectByteBuffer (final byte[] values)
static DoubleBuffer | newDirectDoubleBuffer (final int numElements)
| Allocates a new direct DoubleBuffer with the specified number of elements. More...
static DoubleBuffer | newDirectDoubleBuffer (final double[] values, final int offset, final int length)
static DoubleBuffer | newDirectDoubleBuffer (final double[] values, final int offset)
static DoubleBuffer | newDirectDoubleBuffer (final double[] values)
static FloatBuffer | newDirectFloatBuffer (final int numElements)
| Allocates a new direct FloatBuffer with the specified number of elements. More...
static FloatBuffer | newDirectFloatBuffer (final float[] values, final int offset, final int length)
static FloatBuffer | newDirectFloatBuffer (final float[] values, final int offset)
static FloatBuffer | newDirectFloatBuffer (final float[] values)
static IntBuffer | newDirectIntBuffer (final int numElements)
| Allocates a new direct IntBuffer with the specified number of elements. More...
static IntBuffer | newDirectIntBuffer (final int[] values, final int offset, final int length)
static IntBuffer | newDirectIntBuffer (final int[] values, final int offset)
static IntBuffer | newDirectIntBuffer (final int[] values)
static LongBuffer | newDirectLongBuffer (final int numElements)
| Allocates a new direct LongBuffer with the specified number of elements. More...
static LongBuffer | newDirectLongBuffer (final long[] values, final int offset, final int length)
static LongBuffer | newDirectLongBuffer (final long[] values, final int offset)
static LongBuffer | newDirectLongBuffer (final long[] values)
static ShortBuffer | newDirectShortBuffer (final int numElements)
| Allocates a new direct ShortBuffer with the specified number of elements. More...
static ShortBuffer | newDirectShortBuffer (final short[] values, final int offset, final int length)
static ShortBuffer | newDirectShortBuffer (final short[] values, final int offset)
static ShortBuffer | newDirectShortBuffer (final short[] values)
static CharBuffer | newDirectCharBuffer (final int numElements)
| Allocates a new direct CharBuffer with the specified number of elements. More...
static CharBuffer | newDirectCharBuffer (final char[] values, final int offset, final int length)
static CharBuffer | newDirectCharBuffer (final char[] values, final int offset)
static CharBuffer | newDirectCharBuffer (final char[] values)
static ByteBuffer | nativeOrder (final ByteBuffer buf)
| Helper routine to set a ByteBuffer to the native byte order, if that operation is supported by the underlying NIO implementation. More...
static Class<? extends Buffer > | typeNameToBufferClass (final String typeName)
| Returns `Buffer` class matching the given lower case `typeName` More...
static int | sizeOfBufferElem (final Class<? extends Buffer > bufferClz)
| Returns the size of a single element of the given buffer class in bytes or `0` if the given buffer is `null`. More...
static int | sizeOfBufferElem (final Object buffer)
| Returns the size of a single element of the given buffer in bytes or `0` if the given buffer is `null`. More...
static int | remainingElem (final Object buffer) throws IllegalArgumentException
| Returns the number of remaining elements of the given anonymous `buffer`. More...
static int | remainingBytes (final Object buffer) throws IllegalArgumentException
| Returns the number of remaining bytes of the given anonymous `buffer`. More...
static boolean | isDirect (final Object buf)
| Helper routine to tell whether a buffer is direct or not. More...
static int | getDirectBufferByteOffset (final Object buf)
| Helper routine to get the Buffer byte offset by taking into account the Buffer position and the underlying type. More...
static Object | getArray (final Object buf) throws UnsupportedOperationException, IllegalArgumentException
| Helper routine to return the array backing store reference from a Buffer object. More...
static int | getIndirectBufferByteOffset (final Object buf)
| Helper routine to get the full byte offset from the beginning of the array that is the storage for the indirect Buffer object. More...
static< B extends Buffer > B | slice (final B buffer)
| Calls slice on the specified buffer while maintaining the byteorder. More...
static< B extends Buffer > B | slice (final B buffer, final int offset, final int size)
| Slices the specified buffer with offset as position and offset+size as limit while maintaining the byteorder. More...
static final FloatBuffer | slice2Float (final Buffer buf, final int elementStartPos, final int elementCount)
| Slices a ByteBuffer or a FloatBuffer to a FloatBuffer at the given `elementStartPos` with the given `elementCount` in float-space. More...
static final FloatBuffer | slice2Float (final float[] backing, final int elementStartPos, final int elementCount)
| Slices a primitive float backing array to a FloatBuffer at the given `elementStartPos` with the given `elementCount` in float-space by `wrapping` the backing array. More...
static final ShortBuffer | slice2Short (final Buffer buf, final int elementStartPos, final int elementCount)
| Slices a ByteBuffer or a ShortBuffer to a ShortBuffer at the given `elementStartPos` with the given `elementCount` in short-space. More...
static final ShortBuffer | slice2Short (final short[] backing, final int elementStartPos, final int elementCount)
| Slices a primitive float backing array to a ShortBuffer at the given `elementStartPos` with the given `elementCount` in short-space by `wrapping` the backing array. More...
static final CharBuffer | slice2Char (final Buffer buf, final int elementStartPos, final int elementCount)
| Slices a ByteBuffer or a CharBuffer to a CharBuffer at the given `elementStartPos` with the given `elementCount` in short-space. More...
static final CharBuffer | slice2Char (final char[] backing, final int elementStartPos, final int elementCount)
| Slices a primitive float backing array to a CharBuffer at the given `elementStartPos` with the given `elementCount` in short-space by `wrapping` the backing array. More...
static final IntBuffer | slice2Int (final Buffer buf, final int elementStartPos, final int elementCount)
| Slices a ByteBuffer or a IntBuffer to a IntBuffer at the given `elementStartPos` with the given `elementCount` in int-space. More...
static final IntBuffer | slice2Int (final int[] backing, final int elementStartPos, final int elementCount)
| Slices a primitive float backing array to a IntBuffer at the given `elementStartPos` with the given `elementCount` in int-space by `wrapping` the backing array. More...
static final LongBuffer | slice2Long (final Buffer buf, final int elementStartPos, final int elementCount)
| Slices a ByteBuffer or a LongBuffer to a LongBuffer at the given `elementStartPos` with the given `elementCount` in long-space. More...
static final LongBuffer | slice2Long (final long[] backing, final int elementStartPos, final int elementCount)
| Slices a primitive float backing array to a LongBuffer at the given `elementStartPos` with the given `elementCount` in long-space by `wrapping` the backing array. More...
static final DoubleBuffer | slice2Double (final Buffer buf, final int elementStartPos, final int elementCount)
| Slices a ByteBuffer or a DoubleBuffer to a DoubleBuffer at the given `elementStartPos` with the given `elementCount` in double-space. More...
static final DoubleBuffer | slice2Double (final double[] backing, final int elementStartPos, final int elementCount)
| Slices a primitive float backing array to a DoubleBuffer at the given `elementStartPos` with the given `elementCount` in double-space by `wrapping` the backing array. More...
static ByteBuffer | copyByteBuffer (final ByteBuffer orig)
| Copies the remaining elements (as defined by `limit() - position()`) in the passed ByteBuffer into a newly-allocated direct ByteBuffer. More...
static FloatBuffer | copyFloatBuffer (final FloatBuffer orig)
| Copies the remaining elements (as defined by `limit() - position()`) in the passed FloatBuffer into a newly-allocated direct FloatBuffer. More...
static IntBuffer | copyIntBuffer (final IntBuffer orig)
| Copies the remaining elements (as defined by `limit() - position()`) in the passed IntBuffer into a newly-allocated direct IntBuffer. More...
static ShortBuffer | copyShortBuffer (final ShortBuffer orig)
| Copies the remaining elements (as defined by `limit() - position()`) in the passed ShortBuffer into a newly-allocated direct ShortBuffer. More...
static ByteBuffer | copyFloatBufferAsByteBuffer (final FloatBuffer orig)
| Copies the remaining elements (as defined by `limit() - position()`) in the passed FloatBuffer into a newly-allocated direct ByteBuffer. More...
static ByteBuffer | copyIntBufferAsByteBuffer (final IntBuffer orig)
| Copies the remaining elements (as defined by `limit() - position()`) in the passed IntBuffer into a newly-allocated direct ByteBuffer. More...
static ByteBuffer | copyShortBufferAsByteBuffer (final ShortBuffer orig)
| Copies the remaining elements (as defined by `limit() - position()`) in the passed ShortBuffer into a newly-allocated direct ByteBuffer. More...
static float[] | getFloatArray (final double[] source, final int soffset, float[] dest, int doffset, int len)
static FloatBuffer | getFloatBuffer (final DoubleBuffer source, FloatBuffer dest)
| No rewind or repositioning is performed. More...
static double[] | getDoubleArray (final float[] source, final int soffset, double[] dest, int doffset, int len)
static DoubleBuffer | getDoubleBuffer (final FloatBuffer source, DoubleBuffer dest)
| No rewind or repositioning is performed. More...
static< B extends Buffer > B | put (final B dest, final Buffer src)
static< B extends Buffer > B | putb (final B dest, final byte v)
static< B extends Buffer > B | put3b (final B dest, final byte v1, final byte v2, final byte v3)
static< B extends Buffer > B | put4b (final B dest, final byte v1, final byte v2, final byte v3, final byte v4)
static< B extends Buffer > B | putb (final B dest, final byte[] src, final int offset, final int length)
static< B extends Buffer > B | puts (final B dest, final short v)
static< B extends Buffer > B | put3s (final B dest, final short v1, final short v2, final short v3)
static< B extends Buffer > B | put4s (final B dest, final short v1, final short v2, final short v3, final short v4)
static< B extends Buffer > B | puts (final B dest, final short[] src, final int offset, final int length)
static< B extends Buffer > B | puti (final B dest, final int v)
static< B extends Buffer > B | put3i (final B dest, final int v1, final int v2, final int v3)
static< B extends Buffer > B | put4i (final B dest, final int v1, final int v2, final int v3, final int v4)
static< B extends Buffer > B | puti (final B dest, final int[] src, final int offset, final int length)
static< B extends Buffer > B | putf (final B dest, final float v)
static< B extends Buffer > B | put3f (final B dest, final float v1, final float v2, final float v3)
static< B extends Buffer > B | put4f (final B dest, final float v1, final float v2, final float v3, final float v4)
static< B extends Buffer > B | putf (final B dest, final float[] src, final int offset, final int length)
static< B extends Buffer > B | putd (final B dest, final double v)
static< B extends Buffer > B | put3d (final B dest, final double v1, final double v2, final double v3)
static< B extends Buffer > B | put4d (final B dest, final double v1, final double v2, final double v3, final double v4)
static< B extends Buffer > B | putd (final B dest, final double[] src, final int offset, final int length)
static< B extends Buffer > B | putNb (final B dest, final boolean dSigned, final byte v, final boolean sSigned)
| Store byte source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation. More...
static< B extends Buffer > B | putNs (final B dest, final boolean dSigned, final short v, final boolean sSigned)
| Store short source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation. More...
static< B extends Buffer > B | putNi (final B dest, final boolean dSigned, final int v, final boolean sSigned)
| Store short source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation. More...
static< B extends Buffer > B | putNf (final B dest, final boolean dSigned, final float v)
| Store float source value in given buffer after normalizing it to the destination value range considering signed and unsigned destination representation. More...
static void | rangeCheck (final byte[] array, final int offset, final int minElementsRemaining)
static void | rangeCheck (final char[] array, final int offset, final int minElementsRemaining)
static void | rangeCheck (final short[] array, final int offset, final int minElementsRemaining)
static void | rangeCheck (final int[] array, final int offset, final int minElementsRemaining)
static void | rangeCheck (final long[] array, final int offset, final int minElementsRemaining)
static void | rangeCheck (final float[] array, final int offset, final int minElementsRemaining)
static void | rangeCheck (final double[] array, final int offset, final int minElementsRemaining)
static void | rangeCheck (final Buffer buffer, final int minElementsRemaining)
static void | rangeCheckBytes (final Object buffer, final int minBytesRemaining) throws IllegalArgumentException, IndexOutOfBoundsException
static StringBuilder | toString (StringBuilder sb, final String f, final Buffer buffer)
| Appends Buffer details inclusive data to a StringBuilder instance. More...
static ByteBuffer | copyNativeToDirectByteBuffer (final long source_address, final long len)
| Copy `len` native bytes @ `source_address` into a newly created direct `ByteBuffer`. More...
static long | getDirectBufferAddress (final Object directBuffer)
static int | strnlen (final long cstrptr, final int maxlen)
| Returns `strnlen(cstrptr, maxlen)` according to POSIX.1-2008. More...

## Static Public Attributes

static final int | SIZEOF_BYTE = 1
static final int | SIZEOF_SHORT = 2
static final int | SIZEOF_CHAR = 2
static final int | SIZEOF_INT = 4
static final int | SIZEOF_FLOAT = 4
static final int | SIZEOF_LONG = 8
static final int | SIZEOF_DOUBLE = 8

## Protected Member Functions

| Buffers ()

## Detailed Description

Utility methods allowing easy `java.nio.Buffer` manipulations.

Author
  Kenneth Russel
  Sven Gothel
  Michael Bien

Definition at line 70 of file Buffers.java.

## Constructor & Destructor Documentation

## ◆ Buffers()

com.jogamp.common.nio.Buffers.Buffers | ( |  | ) |

protected

Definition at line 85 of file Buffers.java.

## Member Function Documentation

## ◆ copyByteBuffer()

static ByteBuffer com.jogamp.common.nio.Buffers.copyByteBuffer | ( | final ByteBuffer | orig | ) |

static

Copies the remaining elements (as defined by `limit() - position()`) in the passed ByteBuffer into a newly-allocated direct ByteBuffer.

The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged.

Definition at line 927 of file Buffers.java.

Here is the call graph for this function:

## ◆ copyFloatBuffer()

static FloatBuffer com.jogamp.common.nio.Buffers.copyFloatBuffer | ( | final FloatBuffer | orig | ) |

static

Copies the remaining elements (as defined by `limit() - position()`) in the passed FloatBuffer into a newly-allocated direct FloatBuffer.

The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged.

Definition at line 944 of file Buffers.java.

Here is the call graph for this function:

## ◆ copyFloatBufferAsByteBuffer()

static ByteBuffer com.jogamp.common.nio.Buffers.copyFloatBufferAsByteBuffer | ( | final FloatBuffer | orig | ) |

static

Copies the remaining elements (as defined by `limit() - position()`) in the passed FloatBuffer into a newly-allocated direct ByteBuffer.

The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged.

Definition at line 983 of file Buffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ copyIntBuffer()

static IntBuffer com.jogamp.common.nio.Buffers.copyIntBuffer | ( | final IntBuffer | orig | ) |

static

Copies the remaining elements (as defined by `limit() - position()`) in the passed IntBuffer into a newly-allocated direct IntBuffer.

The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged.

Definition at line 956 of file Buffers.java.

Here is the call graph for this function:

## ◆ copyIntBufferAsByteBuffer()

static ByteBuffer com.jogamp.common.nio.Buffers.copyIntBufferAsByteBuffer | ( | final IntBuffer | orig | ) |

static

Copies the remaining elements (as defined by `limit() - position()`) in the passed IntBuffer into a newly-allocated direct ByteBuffer.

The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged.

Definition at line 1000 of file Buffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ copyNativeToDirectByteBuffer()

static ByteBuffer com.jogamp.common.nio.Buffers.copyNativeToDirectByteBuffer | ( | final long | source_address,
|  | final long | len
| ) |  |

static

Copy `len` native bytes @ `source_address` into a newly created direct `ByteBuffer`.

Parameters

  source_address | memory address of bytes to copy from
  len | number of bytes to copy

Returns
  newly created direct `ByteBuffer` holding the copied bytes

Definition at line 2070 of file Buffers.java.

Here is the call graph for this function:

## ◆ copyShortBuffer()

static ShortBuffer com.jogamp.common.nio.Buffers.copyShortBuffer | ( | final ShortBuffer | orig | ) |

static

Copies the remaining elements (as defined by `limit() - position()`) in the passed ShortBuffer into a newly-allocated direct ShortBuffer.

The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged.

Definition at line 968 of file Buffers.java.

Here is the call graph for this function:

## ◆ copyShortBufferAsByteBuffer()

static ByteBuffer com.jogamp.common.nio.Buffers.copyShortBufferAsByteBuffer | ( | final ShortBuffer | orig | ) |

static

Copies the remaining elements (as defined by `limit() - position()`) in the passed ShortBuffer into a newly-allocated direct ByteBuffer.

The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged.

Definition at line 1017 of file Buffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ getArray()

static Object com.jogamp.common.nio.Buffers.getArray | ( | final Object | buf | ) | throws UnsupportedOperationException, IllegalArgumentException

static

Helper routine to return the array backing store reference from a Buffer object.

Exceptions

  UnsupportedOperationException | if the passed Object does not have an array backing store
  IllegalArgumentException | if the passed Object is neither of type `java.nio.Buffer` or `NativeBuffer`.

Definition at line 444 of file Buffers.java.

## ◆ getDirectBufferAddress()

static long com.jogamp.common.nio.Buffers.getDirectBufferAddress | ( | final Object | directBuffer | ) |

static

Definition at line 2086 of file Buffers.java.

Here is the caller graph for this function:

## ◆ getDirectBufferByteOffset()

static int com.jogamp.common.nio.Buffers.getDirectBufferByteOffset | ( | final Object | buf | ) |

static

Helper routine to get the Buffer byte offset by taking into account the Buffer position and the underlying type.

This is the total offset for Direct Buffers.

Definition at line 409 of file Buffers.java.

Here is the call graph for this function:

## ◆ getDoubleArray()

static double[] com.jogamp.common.nio.Buffers.getDoubleArray | ( | final float[] | source,
|  | final int | soffset,
|  | double[] | dest,
|  | int | doffset,
|  | int | len
| ) |  |

static

Parameters

  source | the source array
  soffset | the offset
  dest | the target array, if null, a new array is being created with size len.
  doffset | the offset in the dest array
  len | the payload of elements to be copied, if `len < 0` then `len = source.length - soffset`

Returns
  the passed or newly created target array

Definition at line 1085 of file Buffers.java.

Here is the caller graph for this function:

## ◆ getDoubleBuffer()

static DoubleBuffer com.jogamp.common.nio.Buffers.getDoubleBuffer | ( | final FloatBuffer | source,
|  | DoubleBuffer | dest
| ) |  |

static

No rewind or repositioning is performed.

Parameters

  source | the source buffer, which elements from it's current position and it's limit are being copied
  dest | the target buffer, if null, a new buffer is being created with size source.remaining()

Returns
  the passed or newly created target buffer

Definition at line 1111 of file Buffers.java.

Here is the call graph for this function:

## ◆ getFloatArray()

static float[] com.jogamp.common.nio.Buffers.getFloatArray | ( | final double[] | source,
|  | final int | soffset,
|  | float[] | dest,
|  | int | doffset,
|  | int | len
| ) |  |

static

Parameters

  source | the source array
  soffset | the offset
  dest | the target array, if null, a new array is being created with size len.
  doffset | the offset in the dest array
  len | the payload of elements to be copied, if `len < 0` then `len = source.length - soffset`

Returns
  the passed or newly created target array

Definition at line 1038 of file Buffers.java.

Here is the caller graph for this function:

## ◆ getFloatBuffer()

static FloatBuffer com.jogamp.common.nio.Buffers.getFloatBuffer | ( | final DoubleBuffer | source,
|  | FloatBuffer | dest
| ) |  |

static

No rewind or repositioning is performed.

Parameters

  source | the source buffer, which elements from it's current position and it's limit are being copied
  dest | the target buffer, if null, a new buffer is being created with size source.remaining()

Returns
  the passed or newly created target buffer

Definition at line 1064 of file Buffers.java.

Here is the call graph for this function:

## ◆ getIndirectBufferByteOffset()

static int com.jogamp.common.nio.Buffers.getIndirectBufferByteOffset | ( | final Object | buf | ) |

static

Helper routine to get the full byte offset from the beginning of the array that is the storage for the indirect Buffer object.

The array offset also includes the position offset within the buffer, in addition to any array offset.

Definition at line 463 of file Buffers.java.

Here is the call graph for this function:

## ◆ isDirect()

static boolean com.jogamp.common.nio.Buffers.isDirect | ( | final Object | buf | ) |

static

Helper routine to tell whether a buffer is direct or not.

Null pointers are considered direct.

Definition at line 392 of file Buffers.java.

Here is the caller graph for this function:

## ◆ nativeOrder()

static ByteBuffer com.jogamp.common.nio.Buffers.nativeOrder | ( | final ByteBuffer | buf | ) |

static

Helper routine to set a ByteBuffer to the native byte order, if that operation is supported by the underlying NIO implementation.

Definition at line 239 of file Buffers.java.

Here is the caller graph for this function:

## ◆ newDirectByteBuffer() [1/4]

static ByteBuffer com.jogamp.common.nio.Buffers.newDirectByteBuffer | ( | final byte[] | values | ) |

static

Definition at line 104 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectByteBuffer() [2/4]

static ByteBuffer com.jogamp.common.nio.Buffers.newDirectByteBuffer | ( | final byte[] | values,
|  | final int | offset
| ) |  |

static

Definition at line 100 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectByteBuffer() [3/4]

static ByteBuffer com.jogamp.common.nio.Buffers.newDirectByteBuffer | ( | final byte[] | values,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 96 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectByteBuffer() [4/4]

static ByteBuffer com.jogamp.common.nio.Buffers.newDirectByteBuffer | ( | final int | numElements | ) |

static

Allocates a new direct ByteBuffer with the specified number of elements.

The returned buffer will have its byte order set to the host platform's native byte order.

Definition at line 92 of file Buffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ newDirectCharBuffer() [1/4]

static CharBuffer com.jogamp.common.nio.Buffers.newDirectCharBuffer | ( | final char[] | values | ) |

static

Definition at line 230 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectCharBuffer() [2/4]

static CharBuffer com.jogamp.common.nio.Buffers.newDirectCharBuffer | ( | final char[] | values,
|  | final int | offset
| ) |  |

static

Definition at line 226 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectCharBuffer() [3/4]

static CharBuffer com.jogamp.common.nio.Buffers.newDirectCharBuffer | ( | final char[] | values,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 222 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectCharBuffer() [4/4]

static CharBuffer com.jogamp.common.nio.Buffers.newDirectCharBuffer | ( | final int | numElements | ) |

static

Allocates a new direct CharBuffer with the specified number of elements.

The returned buffer will have its byte order set to the host platform's native byte order.

Definition at line 218 of file Buffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ newDirectDoubleBuffer() [1/4]

static DoubleBuffer com.jogamp.common.nio.Buffers.newDirectDoubleBuffer | ( | final double[] | values | ) |

static

Definition at line 125 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectDoubleBuffer() [2/4]

static DoubleBuffer com.jogamp.common.nio.Buffers.newDirectDoubleBuffer | ( | final double[] | values,
|  | final int | offset
| ) |  |

static

Definition at line 121 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectDoubleBuffer() [3/4]

static DoubleBuffer com.jogamp.common.nio.Buffers.newDirectDoubleBuffer | ( | final double[] | values,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 117 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectDoubleBuffer() [4/4]

static DoubleBuffer com.jogamp.common.nio.Buffers.newDirectDoubleBuffer | ( | final int | numElements | ) |

static

Allocates a new direct DoubleBuffer with the specified number of elements.

The returned buffer will have its byte order set to the host platform's native byte order.

Definition at line 113 of file Buffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ newDirectFloatBuffer() [1/4]

static FloatBuffer com.jogamp.common.nio.Buffers.newDirectFloatBuffer | ( | final float[] | values | ) |

static

Definition at line 146 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectFloatBuffer() [2/4]

static FloatBuffer com.jogamp.common.nio.Buffers.newDirectFloatBuffer | ( | final float[] | values,
|  | final int | offset
| ) |  |

static

Definition at line 142 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectFloatBuffer() [3/4]

static FloatBuffer com.jogamp.common.nio.Buffers.newDirectFloatBuffer | ( | final float[] | values,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 138 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectFloatBuffer() [4/4]

static FloatBuffer com.jogamp.common.nio.Buffers.newDirectFloatBuffer | ( | final int | numElements | ) |

static

Allocates a new direct FloatBuffer with the specified number of elements.

The returned buffer will have its byte order set to the host platform's native byte order.

Definition at line 134 of file Buffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ newDirectIntBuffer() [1/4]

static IntBuffer com.jogamp.common.nio.Buffers.newDirectIntBuffer | ( | final int | numElements | ) |

static

Allocates a new direct IntBuffer with the specified number of elements.

The returned buffer will have its byte order set to the host platform's native byte order.

Definition at line 155 of file Buffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ newDirectIntBuffer() [2/4]

static IntBuffer com.jogamp.common.nio.Buffers.newDirectIntBuffer | ( | final int[] | values | ) |

static

Definition at line 167 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectIntBuffer() [3/4]

static IntBuffer com.jogamp.common.nio.Buffers.newDirectIntBuffer | ( | final int[] | values,
|  | final int | offset
| ) |  |

static

Definition at line 163 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectIntBuffer() [4/4]

static IntBuffer com.jogamp.common.nio.Buffers.newDirectIntBuffer | ( | final int[] | values,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 159 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectLongBuffer() [1/4]

static LongBuffer com.jogamp.common.nio.Buffers.newDirectLongBuffer | ( | final int | numElements | ) |

static

Allocates a new direct LongBuffer with the specified number of elements.

The returned buffer will have its byte order set to the host platform's native byte order.

Definition at line 176 of file Buffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ newDirectLongBuffer() [2/4]

static LongBuffer com.jogamp.common.nio.Buffers.newDirectLongBuffer | ( | final long[] | values | ) |

static

Definition at line 188 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectLongBuffer() [3/4]

static LongBuffer com.jogamp.common.nio.Buffers.newDirectLongBuffer | ( | final long[] | values,
|  | final int | offset
| ) |  |

static

Definition at line 184 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectLongBuffer() [4/4]

static LongBuffer com.jogamp.common.nio.Buffers.newDirectLongBuffer | ( | final long[] | values,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 180 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectShortBuffer() [1/4]

static ShortBuffer com.jogamp.common.nio.Buffers.newDirectShortBuffer | ( | final int | numElements | ) |

static

Allocates a new direct ShortBuffer with the specified number of elements.

The returned buffer will have its byte order set to the host platform's native byte order.

Definition at line 197 of file Buffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ newDirectShortBuffer() [2/4]

static ShortBuffer com.jogamp.common.nio.Buffers.newDirectShortBuffer | ( | final short[] | values | ) |

static

Definition at line 209 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectShortBuffer() [3/4]

static ShortBuffer com.jogamp.common.nio.Buffers.newDirectShortBuffer | ( | final short[] | values,
|  | final int | offset
| ) |  |

static

Definition at line 205 of file Buffers.java.

Here is the call graph for this function:

## ◆ newDirectShortBuffer() [4/4]

static ShortBuffer com.jogamp.common.nio.Buffers.newDirectShortBuffer | ( | final short[] | values,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 201 of file Buffers.java.

Here is the call graph for this function:

## ◆ put()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.put | ( | final B | dest,
|  | final Buffer | src
| ) |  |

static

Definition at line 1130 of file Buffers.java.

## ◆ put3b()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.put3b | ( | final B | dest,
|  | final byte | v1,
|  | final byte | v2,
|  | final byte | v3
| ) |  |

static

Definition at line 1171 of file Buffers.java.

## ◆ put3d()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.put3d | ( | final B | dest,
|  | final double | v1,
|  | final double | v2,
|  | final double | v3
| ) |  |

static

Definition at line 1639 of file Buffers.java.

## ◆ put3f()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.put3f | ( | final B | dest,
|  | final float | v1,
|  | final float | v2,
|  | final float | v3
| ) |  |

static

Definition at line 1573 of file Buffers.java.

## ◆ put3i()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.put3i | ( | final B | dest,
|  | final int | v1,
|  | final int | v2,
|  | final int | v3
| ) |  |

static

Definition at line 1465 of file Buffers.java.

## ◆ put3s()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.put3s | ( | final B | dest,
|  | final short | v1,
|  | final short | v2,
|  | final short | v3
| ) |  |

static

Definition at line 1338 of file Buffers.java.

## ◆ put4b()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.put4b | ( | final B | dest,
|  | final byte | v1,
|  | final byte | v2,
|  | final byte | v3,
|  | final byte | v4
| ) |  |

static

Definition at line 1220 of file Buffers.java.

## ◆ put4d()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.put4d | ( | final B | dest,
|  | final double | v1,
|  | final double | v2,
|  | final double | v3,
|  | final double | v4
| ) |  |

static

Definition at line 1658 of file Buffers.java.

## ◆ put4f()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.put4f | ( | final B | dest,
|  | final float | v1,
|  | final float | v2,
|  | final float | v3,
|  | final float | v4
| ) |  |

static

Definition at line 1592 of file Buffers.java.

## ◆ put4i()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.put4i | ( | final B | dest,
|  | final int | v1,
|  | final int | v2,
|  | final int | v3,
|  | final int | v4
| ) |  |

static

Definition at line 1496 of file Buffers.java.

## ◆ put4s()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.put4s | ( | final B | dest,
|  | final short | v1,
|  | final short | v2,
|  | final short | v3,
|  | final short | v4
| ) |  |

static

Definition at line 1375 of file Buffers.java.

## ◆ putb() [1/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.putb | ( | final B | dest,
|  | final byte | v
| ) |  |

static

Definition at line 1150 of file Buffers.java.

## ◆ putb() [2/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.putb | ( | final B | dest,
|  | final byte[] | src,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 1276 of file Buffers.java.

## ◆ putd() [1/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.putd | ( | final B | dest,
|  | final double | v
| ) |  |

static

Definition at line 1628 of file Buffers.java.

## ◆ putd() [2/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.putd | ( | final B | dest,
|  | final double[] | src,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 1679 of file Buffers.java.

## ◆ putf() [1/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.putf | ( | final B | dest,
|  | final float | v
| ) |  |

static

Definition at line 1558 of file Buffers.java.

## ◆ putf() [2/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.putf | ( | final B | dest,
|  | final float[] | src,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 1613 of file Buffers.java.

## ◆ puti() [1/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.puti | ( | final B | dest,
|  | final int | v
| ) |  |

static

Definition at line 1450 of file Buffers.java.

## ◆ puti() [2/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.puti | ( | final B | dest,
|  | final int[] | src,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 1531 of file Buffers.java.

## ◆ putNb()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.putNb | ( | final B | dest,
|  | final boolean | dSigned,
|  | final byte | v,
|  | final boolean | sSigned
| ) |  |

static

Store byte source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation.

Parameters

  dest | One of `ByteBuffer`, `ShortBuffer`, `IntBuffer`, `FloatBuffer`
  dSigned | true if destination buffer holds signed values, false if destination buffer holds unsigned values
  v | source byte value to be put in dest buffer
  sSigned | true if source represents a signed value, false if source represents an unsigned value

Definition at line 1707 of file Buffers.java.

Here is the call graph for this function:

## ◆ putNf()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.putNf | ( | final B | dest,
|  | final boolean | dSigned,
|  | final float | v
| ) |  |

static

Store float source value in given buffer after normalizing it to the destination value range considering signed and unsigned destination representation.

Parameters

  dest | One of `ByteBuffer`, `ShortBuffer`, `IntBuffer`, `FloatBuffer`
  dSigned | true if destination buffer holds signed values, false if destination buffer holds unsigned values
  v | source float value to be put in dest buffer

Definition at line 1778 of file Buffers.java.

Here is the call graph for this function:

## ◆ putNi()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.putNi | ( | final B | dest,
|  | final boolean | dSigned,
|  | final int | v,
|  | final boolean | sSigned
| ) |  |

static

Store short source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation.

Parameters

  dest | One of `ByteBuffer`, `ShortBuffer`, `IntBuffer`, `FloatBuffer`
  dSigned | true if destination buffer holds signed values, false if destination buffer holds unsigned values
  v | source short value to be put in dest buffer
  sSigned | true if source represents a signed value, false if source represents an unsigned value

Definition at line 1755 of file Buffers.java.

Here is the call graph for this function:

## ◆ putNs()

static< B extends Buffer > B com.jogamp.common.nio.Buffers.putNs | ( | final B | dest,
|  | final boolean | dSigned,
|  | final short | v,
|  | final boolean | sSigned
| ) |  |

static

Store short source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation.

Parameters

  dest | One of `ByteBuffer`, `ShortBuffer`, `IntBuffer`, `FloatBuffer`
  dSigned | true if destination buffer holds signed values, false if destination buffer holds unsigned values
  v | source short value to be put in dest buffer
  sSigned | true if source represents a signed value, false if source represents an unsigned value

Definition at line 1731 of file Buffers.java.

Here is the call graph for this function:

## ◆ puts() [1/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.puts | ( | final B | dest,
|  | final short | v
| ) |  |

static

Definition at line 1321 of file Buffers.java.

## ◆ puts() [2/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.puts | ( | final B | dest,
|  | final short[] | src,
|  | final int | offset,
|  | final int | length
| ) |  |

static

Definition at line 1417 of file Buffers.java.

## ◆ rangeCheck() [1/8]

static void com.jogamp.common.nio.Buffers.rangeCheck | ( | final Buffer | buffer,
|  | final int | minElementsRemaining
| ) |  |

static

Definition at line 1866 of file Buffers.java.

## ◆ rangeCheck() [2/8]

static void com.jogamp.common.nio.Buffers.rangeCheck | ( | final byte[] | array,
|  | final int | offset,
|  | final int | minElementsRemaining
| ) |  |

static

Definition at line 1796 of file Buffers.java.

## ◆ rangeCheck() [3/8]

static void com.jogamp.common.nio.Buffers.rangeCheck | ( | final char[] | array,
|  | final int | offset,
|  | final int | minElementsRemaining
| ) |  |

static

Definition at line 1806 of file Buffers.java.

## ◆ rangeCheck() [4/8]

static void com.jogamp.common.nio.Buffers.rangeCheck | ( | final double[] | array,
|  | final int | offset,
|  | final int | minElementsRemaining
| ) |  |

static

Definition at line 1856 of file Buffers.java.

## ◆ rangeCheck() [5/8]

static void com.jogamp.common.nio.Buffers.rangeCheck | ( | final float[] | array,
|  | final int | offset,
|  | final int | minElementsRemaining
| ) |  |

static

Definition at line 1846 of file Buffers.java.

## ◆ rangeCheck() [6/8]

static void com.jogamp.common.nio.Buffers.rangeCheck | ( | final int[] | array,
|  | final int | offset,
|  | final int | minElementsRemaining
| ) |  |

static

Definition at line 1826 of file Buffers.java.

## ◆ rangeCheck() [7/8]

static void com.jogamp.common.nio.Buffers.rangeCheck | ( | final long[] | array,
|  | final int | offset,
|  | final int | minElementsRemaining
| ) |  |

static

Definition at line 1836 of file Buffers.java.

## ◆ rangeCheck() [8/8]

static void com.jogamp.common.nio.Buffers.rangeCheck | ( | final short[] | array,
|  | final int | offset,
|  | final int | minElementsRemaining
| ) |  |

static

Definition at line 1816 of file Buffers.java.

## ◆ rangeCheckBytes()

static void com.jogamp.common.nio.Buffers.rangeCheckBytes | ( | final Object | buffer,
|  | final int | minBytesRemaining
| ) |  | throws IllegalArgumentException, IndexOutOfBoundsException

static

Parameters

  buffer | buffer to test for minimum
  minBytesRemaining | minimum bytes remaining

Exceptions

  IllegalArgumentException | if `buffer` is of invalid type.
  IndexOutOfBoundsException | if `remainingBytes(Object)` is < `minBytesRemaining`.``

Definition at line 1882 of file Buffers.java.

Here is the call graph for this function:

## ◆ remainingBytes()

static int com.jogamp.common.nio.Buffers.remainingBytes | ( | final Object | buffer | ) | throws IllegalArgumentException

static

Returns the number of remaining bytes of the given anonymous `buffer`.

Parameters

  buffer | Anonymous Buffer of type `NativeBuffer` or a derivation of `Buffer`.

Returns
  If `buffer` is null, returns `0`, otherwise the remaining size in bytes.``

Exceptions

  IllegalArgumentException | ``if `buffer` is of invalid type.``

Definition at line 355 of file Buffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ remainingElem()

static int com.jogamp.common.nio.Buffers.remainingElem | ( | final Object | buffer | ) | throws IllegalArgumentException

static

Returns the number of remaining elements of the given anonymous `buffer`.

Parameters

  buffer | Anonymous Buffer of type `NativeBuffer` or a derivation of `Buffer`.

Returns
  If `buffer` is null, returns `0`, otherwise the remaining size in elements.``

Exceptions

  IllegalArgumentException | ``if `buffer` is of invalid type.``

Definition at line 335 of file Buffers.java.

## ◆ sizeOfBufferElem() [1/2]

static int com.jogamp.common.nio.Buffers.sizeOfBufferElem | ( | final Class<? extends Buffer > | bufferClz | ) |

static

Returns the size of a single element of the given buffer class in bytes or `0` if the given buffer is `null`.

See also
  typeNameToBufferClass(String)
  sizeOfBufferElem(Object)

Definition at line 277 of file Buffers.java.

## ◆ sizeOfBufferElem() [2/2]

static int com.jogamp.common.nio.Buffers.sizeOfBufferElem | ( | final Object | buffer | ) |

static

Returns the size of a single element of the given buffer in bytes or `0` if the given buffer is `null`.

See also
  #sizeOfBufferElem(Class)

Definition at line 304 of file Buffers.java.

## ◆ slice() [1/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.slice | ( | final B | buffer | ) |

static

Calls slice on the specified buffer while maintaining the byteorder.

See also
  slice(java.nio.Buffer, int, int)

Definition at line 501 of file Buffers.java.

Here is the caller graph for this function:

## ◆ slice() [2/2]

static< B extends Buffer > B com.jogamp.common.nio.Buffers.slice | ( | final B | buffer,
|  | final int | offset,
|  | final int | size
| ) |  |

static

Slices the specified buffer with offset as position and offset+size as limit while maintaining the byteorder.

Concurrency warning: this method changes the buffers position and limit but will restore it before return.

Definition at line 527 of file Buffers.java.

Here is the call graph for this function:

## ◆ slice2Char() [1/2]

static final CharBuffer com.jogamp.common.nio.Buffers.slice2Char | ( | final Buffer | buf,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a ByteBuffer or a CharBuffer to a CharBuffer at the given `elementStartPos` with the given `elementCount` in short-space.

The returned sliced buffer's start position is zero.

See `slice2Float(Buffer, int, int)` for details.

Parameters

  buf | source Buffer, maybe ByteBuffer (recommended) or CharBuffer. Buffer's position is ignored and `elementStartPos` is being used.
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_CHAR`
  elementCount | element count for element of size `Buffers#SIZEOF_CHAR`

Returns
  CharBuffer w/ native byte order as given ByteBuffer

See also
  slice2Float(Buffer, int, int)

Definition at line 694 of file Buffers.java.

## ◆ slice2Char() [2/2]

static final CharBuffer com.jogamp.common.nio.Buffers.slice2Char | ( | final char[] | backing,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a primitive float backing array to a CharBuffer at the given `elementStartPos` with the given `elementCount` in short-space by `wrapping` the backing array.

See `slice2Float(float[], int, int)` for details.

Parameters

  backing | source float array
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_CHAR`
  elementCount | element count for element of size `Buffers#SIZEOF_CHAR`

Returns
  CharBuffer w/ native byte order as given ByteBuffer

See also
  slice2Float(float[], int, int)

Definition at line 733 of file Buffers.java.

## ◆ slice2Double() [1/2]

static final DoubleBuffer com.jogamp.common.nio.Buffers.slice2Double | ( | final Buffer | buf,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a ByteBuffer or a DoubleBuffer to a DoubleBuffer at the given `elementStartPos` with the given `elementCount` in double-space.

The returned sliced buffer's start position is zero.

See `slice2Float(Buffer, int, int)` for details.

Parameters

  buf | source Buffer, maybe ByteBuffer (recommended) or DoubleBuffer. Buffer's position is ignored and `elementStartPos` is being used.
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_DOUBLE`
  elementCount | element count for element of size `Buffers#SIZEOF_DOUBLE`

Returns
  DoubleBuffer w/ native byte order as given ByteBuffer

See also
  slice2Float(Buffer, int, int)

Definition at line 874 of file Buffers.java.

## ◆ slice2Double() [2/2]

static final DoubleBuffer com.jogamp.common.nio.Buffers.slice2Double | ( | final double[] | backing,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a primitive float backing array to a DoubleBuffer at the given `elementStartPos` with the given `elementCount` in double-space by `wrapping` the backing array.

See `slice2Float(float[], int, int)` for details.

Parameters

  backing | source float array
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_DOUBLE`
  elementCount | element count for element of size `Buffers#SIZEOF_DOUBLE`

Returns
  DoubleBuffer w/ native byte order as given ByteBuffer

See also
  slice2Float(float[], int, int)

Definition at line 913 of file Buffers.java.

## ◆ slice2Float() [1/2]

static final FloatBuffer com.jogamp.common.nio.Buffers.slice2Float | ( | final Buffer | buf,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a ByteBuffer or a FloatBuffer to a FloatBuffer at the given `elementStartPos` with the given `elementCount` in float-space.

The returned sliced buffer's start position is zero.

The returned sliced buffer is `marked` at it's `start position`. Hence `FloatBuffer#reset()` will rewind it to start after applying relative operations like `FloatBuffer#get()`.

Using a ByteBuffer as the source guarantees keeping the source native order programmatically. This works around Honeycomb / Android 3.0 Issue 16434. This bug is resolved at least in Android 3.2.

Parameters

  buf | source Buffer, maybe ByteBuffer (recommended) or FloatBuffer. Buffer's position is ignored and `elementStartPos` is being used.
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_FLOAT`
  elementCount | element count for element of size `Buffers#SIZEOF_FLOAT`

Returns
  FloatBuffer w/ native byte order as given ByteBuffer

Definition at line 565 of file Buffers.java.

## ◆ slice2Float() [2/2]

static final FloatBuffer com.jogamp.common.nio.Buffers.slice2Float | ( | final float[] | backing,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a primitive float backing array to a FloatBuffer at the given `elementStartPos` with the given `elementCount` in float-space by `wrapping` the backing array.

Due to `wrapping` the backing array, the returned sliced buffer's `start position` equals the given `floatStartPos` within the given backing array while it's `array-offset` is zero. This has the advantage of being able to dismiss the `array-offset` in user code, while only being required to consider it's `position`.

The returned sliced buffer is `marked` at it's `start position`. Hence `FloatBuffer#reset()` will rewind it to start after applying relative operations like `FloatBuffer#get()`.

Parameters

  backing | source float array
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_FLOAT`
  elementCount | element count for element of size `Buffers#SIZEOF_FLOAT`

Returns
  FloatBuffer w/ native byte order as given ByteBuffer

Definition at line 613 of file Buffers.java.

## ◆ slice2Int() [1/2]

static final IntBuffer com.jogamp.common.nio.Buffers.slice2Int | ( | final Buffer | buf,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a ByteBuffer or a IntBuffer to a IntBuffer at the given `elementStartPos` with the given `elementCount` in int-space.

The returned sliced buffer's start position is zero.

See `slice2Float(Buffer, int, int)` for details.

Parameters

  buf | source Buffer, maybe ByteBuffer (recommended) or IntBuffer. Buffer's position is ignored and `elementStartPos` is being used.
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_INT`
  elementCount | element count for element of size `Buffers#SIZEOF_INT`

Returns
  IntBuffer w/ native byte order as given ByteBuffer

See also
  slice2Float(Buffer, int, int)

Definition at line 754 of file Buffers.java.

## ◆ slice2Int() [2/2]

static final IntBuffer com.jogamp.common.nio.Buffers.slice2Int | ( | final int[] | backing,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a primitive float backing array to a IntBuffer at the given `elementStartPos` with the given `elementCount` in int-space by `wrapping` the backing array.

See `slice2Float(float[], int, int)` for details.

Parameters

  backing | source float array
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_INT`
  elementCount | element count for element of size `Buffers#SIZEOF_INT`

Returns
  IntBuffer w/ native byte order as given ByteBuffer

See also
  slice2Float(float[], int, int)

Definition at line 793 of file Buffers.java.

## ◆ slice2Long() [1/2]

static final LongBuffer com.jogamp.common.nio.Buffers.slice2Long | ( | final Buffer | buf,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a ByteBuffer or a LongBuffer to a LongBuffer at the given `elementStartPos` with the given `elementCount` in long-space.

The returned sliced buffer's start position is zero.

See `slice2Float(Buffer, int, int)` for details.

Parameters

  buf | source Buffer, maybe ByteBuffer (recommended) or LongBuffer. Buffer's position is ignored and `elementStartPos` is being used.
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_LONG`
  elementCount | element count for element of size `Buffers#SIZEOF_LONG`

Returns
  LongBuffer w/ native byte order as given ByteBuffer

See also
  slice2Float(Buffer, int, int)

Definition at line 814 of file Buffers.java.

## ◆ slice2Long() [2/2]

static final LongBuffer com.jogamp.common.nio.Buffers.slice2Long | ( | final long[] | backing,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a primitive float backing array to a LongBuffer at the given `elementStartPos` with the given `elementCount` in long-space by `wrapping` the backing array.

See `slice2Float(float[], int, int)` for details.

Parameters

  backing | source float array
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_LONG`
  elementCount | element count for element of size `Buffers#SIZEOF_LONG`

Returns
  LongBuffer w/ native byte order as given ByteBuffer

See also
  slice2Float(float[], int, int)

Definition at line 853 of file Buffers.java.

## ◆ slice2Short() [1/2]

static final ShortBuffer com.jogamp.common.nio.Buffers.slice2Short | ( | final Buffer | buf,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a ByteBuffer or a ShortBuffer to a ShortBuffer at the given `elementStartPos` with the given `elementCount` in short-space.

The returned sliced buffer's start position is zero.

See `slice2Float(Buffer, int, int)` for details.

Parameters

  buf | source Buffer, maybe ByteBuffer (recommended) or ShortBuffer. Buffer's position is ignored and `elementStartPos` is being used.
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_SHORT`
  elementCount | element count for element of size `Buffers#SIZEOF_SHORT`

Returns
  ShortBuffer w/ native byte order as given ByteBuffer

See also
  slice2Float(Buffer, int, int)

Definition at line 634 of file Buffers.java.

## ◆ slice2Short() [2/2]

static final ShortBuffer com.jogamp.common.nio.Buffers.slice2Short | ( | final short[] | backing,
|  | final int | elementStartPos,
|  | final int | elementCount
| ) |  |

static

Slices a primitive float backing array to a ShortBuffer at the given `elementStartPos` with the given `elementCount` in short-space by `wrapping` the backing array.

See `slice2Float(float[], int, int)` for details.

Parameters

  backing | source float array
  elementStartPos | element start position w/ element of size `Buffers#SIZEOF_SHORT`
  elementCount | element count for element of size `Buffers#SIZEOF_SHORT`

Returns
  ShortBuffer w/ native byte order as given ByteBuffer

See also
  slice2Float(float[], int, int)

Definition at line 673 of file Buffers.java.

## ◆ strnlen()

static int com.jogamp.common.nio.Buffers.strnlen | ( | final long | cstrptr,
|  | final int | maxlen
| ) |  |

static

Returns `strnlen(cstrptr, maxlen)` according to POSIX.1-2008.

The `strnlen()` function returns the number of bytes in the string pointed to by `cstrptr`, excluding the terminating null byte ('\0'), but at most `maxlen`. In doing this, `strnlen()` looks only at the first `maxlen` characters in the string pointed to by `cstrptr` and never beyond `cstrptr[maxlen-1]`.

Definition at line 2115 of file Buffers.java.

## ◆ toString()

static StringBuilder com.jogamp.common.nio.Buffers.toString | ( | StringBuilder | sb,
|  | final String | f,
|  | final Buffer | buffer
| ) |  |

static

Appends Buffer details inclusive data to a StringBuilder instance.

Parameters

  sb | optional pass through StringBuilder
  f | optional format string of one element, i.e. "%10.5f" for `FloatBuffer`, see `java.util.Formatter`, or `null` for unformatted output. Note: Caller is responsible to match the format string w/ the data type as expected in the given buffer.
  buffer | Any valid Buffer instance

Returns
  the modified StringBuilder containing the Buffer details

Definition at line 1901 of file Buffers.java.

## ◆ typeNameToBufferClass()

static Class<? extends Buffer > com.jogamp.common.nio.Buffers.typeNameToBufferClass | ( | final String | typeName | ) |

static

Returns `Buffer` class matching the given lower case `typeName`

Parameters

  typeName | lower-case type name

Returns
  matching `Buffer` class or `null`

See also
  #sizeOfBufferElem(Class)

Definition at line 249 of file Buffers.java.

## Member Data Documentation

## ◆ SIZEOF_BYTE

final int com.jogamp.common.nio.Buffers.SIZEOF_BYTE = 1

static

Definition at line 77 of file Buffers.java.

## ◆ SIZEOF_CHAR

final int com.jogamp.common.nio.Buffers.SIZEOF_CHAR = 2

static

Definition at line 79 of file Buffers.java.

## ◆ SIZEOF_DOUBLE

final int com.jogamp.common.nio.Buffers.SIZEOF_DOUBLE = 8

static

Definition at line 83 of file Buffers.java.

## ◆ SIZEOF_FLOAT

final int com.jogamp.common.nio.Buffers.SIZEOF_FLOAT = 4

static

Definition at line 81 of file Buffers.java.

## ◆ SIZEOF_INT

final int com.jogamp.common.nio.Buffers.SIZEOF_INT = 4

static

Definition at line 80 of file Buffers.java.

## ◆ SIZEOF_LONG

final int com.jogamp.common.nio.Buffers.SIZEOF_LONG = 8

static

Definition at line 82 of file Buffers.java.

## ◆ SIZEOF_SHORT

final int com.jogamp.common.nio.Buffers.SIZEOF_SHORT = 2

static

Definition at line 78 of file Buffers.java.

The documentation for this class was generated from the following file:

- src/java/com/jogamp/common/nio/Buffers.java