GlueGen: com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer > Interface Template Reference

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

Public Member Functions | List of all members
com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer > Interface Template Reference

Hardware independent container for various kinds of buffers. More...

Inheritance diagram for com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >:
Collaboration diagram for com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >:

## Public Member Functions

int | elementSize ()
| Returns byte size of one element. More...
int | limit ()
| Returns this buffer's element limit. More...
B | limit (int newLim)
| Sets this buffer's element limit. More...
int | capacity ()
| Returns this buffer's element capacity. More...
int | position ()
| Returns this buffer's element position. More...
B | position (int newPos)
| Sets this buffer's element position. More...
int | remaining ()
| Returns this buffer's remaining element, i.e. More...
boolean | hasRemaining ()
| Returns `remaining()` > 0. More...
B | clear ()
| Sets the limit to the capacity and the position to zero. More...
B | flip ()
| Sets the limit to the current position and the position to zero. More...
B | rewind ()
| Sets the position to zero. More...
boolean | hasArray ()
int | arrayOffset ()
Object | array () throws UnsupportedOperationException
Buffer | getBuffer ()
| Returns the underlying buffer object. More...
boolean | isDirect ()
| Return true if the underlying buffer is NIO direct, otherwise false. More...
long | getDirectBufferAddress ()
| Returns the native address of the underlying buffer if `isDirect()`, otherwise `0`. More...
void | storeDirectAddress (final ByteBuffer directDest)
| Store the `getDirectBufferAddress()` into the given `ByteBuffer` using relative put. More...
void | storeDirectAddress (final ByteBuffer directDest, final int destOffset)
| Store the `getDirectBufferAddress()` into the given `ByteBuffer` using absolute put. More...
B | put (B src)
| Relative bulk get method. More...

## Detailed Description

Hardware independent container for various kinds of buffers.

Implementations follow `Buffer` semantics, e.g.

          0 <= position <= limit <= capacity

Author
  Sven Gothel
  Michael Bien

Definition at line 49 of file NativeBuffer.java.

## Member Function Documentation

## ◆ array()

Object com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.array | ( |  | ) | throws UnsupportedOperationException

Returns
  the primitive backup array of the buffer if `hasArray()` is true, otherwise it throws `java.lang.UnsupportedOperationException`. The returned primitive array maybe of type `int[]` or `long[]`, etc ..

Exceptions

  UnsupportedOperationException | if this object has no backup array

See also
  hasArray()

## ◆ arrayOffset()

int com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.arrayOffset | ( |  | ) |

Returns
  the array offset of the optional primitive backup array of the buffer if `hasArray()` is true, otherwise 0.

Here is the caller graph for this function:

## ◆ capacity()

int com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.capacity | ( |  | ) |

Returns this buffer's element capacity.

## ◆ clear()

B com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.clear | ( |  | ) |

Sets the limit to the capacity and the position to zero.

## ◆ elementSize()

int com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.elementSize | ( |  | ) |

Returns byte size of one element.

Here is the caller graph for this function:

## ◆ flip()

B com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.flip | ( |  | ) |

Sets the limit to the current position and the position to zero.

## ◆ getBuffer()

Buffer com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.getBuffer | ( |  | ) |

Returns the underlying buffer object.

## ◆ getDirectBufferAddress()

long com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.getDirectBufferAddress | ( |  | ) |

Returns the native address of the underlying buffer if `isDirect()`, otherwise `0`.

## ◆ hasArray()

boolean com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.hasArray | ( |  | ) |

Returns
  true if this buffer has a primitive backup array, otherwise false

## ◆ hasRemaining()

boolean com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.hasRemaining | ( |  | ) |

Returns `remaining()` > 0.

## ◆ isDirect()

boolean com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.isDirect | ( |  | ) |

Return true if the underlying buffer is NIO direct, otherwise false.

## ◆ limit() [1/2]

int com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.limit | ( |  | ) |

Returns this buffer's element limit.

## ◆ limit() [2/2]

B com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.limit | ( | int | newLim | ) |

Sets this buffer's element limit.

## ◆ position() [1/2]

int com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.position | ( |  | ) |

Returns this buffer's element position.

Here is the caller graph for this function:

## ◆ position() [2/2]

B com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.position | ( | int | newPos | ) |

Sets this buffer's element position.

## ◆ put()

B com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.put | ( | B | src | ) |

Relative bulk get method.

Copy the source values `src[position .. capacity] [` to this buffer and increment the position by `capacity-position`.

## ◆ remaining()

int com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.remaining | ( |  | ) |

Returns this buffer's remaining element, i.e.

limit - position.

Here is the caller graph for this function:

## ◆ rewind()

B com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.rewind | ( |  | ) |

Sets the position to zero.

## ◆ storeDirectAddress() [1/2]

void com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.storeDirectAddress | ( | final ByteBuffer | directDest | ) |

Store the `getDirectBufferAddress()` into the given `ByteBuffer` using relative put.

The native pointer value is stored either as a 32bit (int) or 64bit (long) wide value, depending of the CPU pointer width.

## ◆ storeDirectAddress() [2/2]

void com.jogamp.common.nio.NativeBuffer< B extends NativeBuffer >.storeDirectAddress | ( | final ByteBuffer | directDest,
|  | final int | destOffset
| ) |  |

Store the `getDirectBufferAddress()` into the given `ByteBuffer` using absolute put.

The native pointer value is stored either as a 32bit (int) or 64bit (long) wide value, depending of the CPU pointer width.

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

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