LongBuffer

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

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

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

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

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: LongBuffer): Int
Link copied to clipboard

Returns a duplicate LongBuffer that shares the underlying data. The duplicate’s position, limit, and byte order are set to the same values.

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(): Long

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

fun get(index: Int): Long

Absolute get method. Reads the long at the specified index (in longs) without changing the current position.

fun get(dst: LongArray, offset: Int, length: Int): LongBuffer

Relative bulk get method.

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): LongBuffer

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): LongBuffer

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: Long): LongBuffer

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

fun put(index: Int, value: Long): LongBuffer

Absolute put method. Writes the given long into the buffer at the specified index (in longs).

Link copied to clipboard
fun remaining(): Int

Returns the number of longs remaining between position and limit.

Link copied to clipboard

Creates a new LongBuffer 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