FloatBuffer

class FloatBuffer(buffer: Buffer, val capacity: Int, baseOffset: Long = 0) : Comparable<FloatBuffer>

ported from java.nio.FloatBuffer

A platform-agnostic FloatBuffer built on top of a kotlin‑io Buffer.

The capacity is in numbers of floats (each float is 4 bytes). The position and limit are expressed in floats. When reading/writing, This version tracks an extra baseOffset (in bytes) so that view buffers (via slice()) share the same underlying Buffer while translating float indices appropriately.

All indices (position, limit, capacity) are in units of floats (4 bytes). we convert indices by multiplying by 4.

Constructors

Link copied to clipboard
constructor(buffer: Buffer, capacity: Int, baseOffset: Long = 0)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
var limit: Int
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Clears this buffer. Sets position to 0 and limit to capacity.

Link copied to clipboard
open operator override fun compareTo(other: FloatBuffer): Int

Compares this buffer to another.

Link copied to clipboard

Returns a duplicate FloatBuffer that shares the underlying data buffer reference but has independent position, limit, and mark values. Changes to the underlying data will be visible in both buffers.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard

Flips this buffer. Sets limit to current position and position to 0.

Link copied to clipboard
fun get(): Float

Relative get method. Reads the float at the current position and then increments the position.

fun get(dst: FloatArray, offset: Int, length: Int): FloatBuffer

Relative bulk get method.

fun get(index: Int): Float

Absolute get method. Reads the float at the specified index (in floats) without changing the current position. Incorporates the baseOffset for sliced buffers.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Returns whether there are any elements remaining between position and limit.

Link copied to clipboard
fun limit(newLimit: Int): FloatBuffer

Sets this buffer's limit. If the position is larger than the new limit then it is set to the new limit. If the mark is defined and larger than the new limit then it is discarded.

Link copied to clipboard
fun position(newPosition: Int): FloatBuffer

Sets this buffer's position. If the mark is defined and larger than the new position then it is discarded.

Link copied to clipboard
fun put(value: Float): FloatBuffer

Relative put method. Writes the given float at the current position and then increments the position.

fun put(src: FloatArray, offset: Int, length: Int): FloatBuffer

Relative bulk put method.

fun put(index: Int, value: Float): FloatBuffer

Absolute put method. Writes the given float into the buffer at the specified index (in floats). Incorporates the baseOffset for sliced buffers.

Link copied to clipboard
fun remaining(): Int

Returns the number of floats remaining between position and limit.

Link copied to clipboard

Creates a new FloatBuffer slice that is a view of this buffer's content from the current position to the limit.

Link copied to clipboard
open override fun toString(): String