ArrayBuffer¶
=== "common"
Represents a buffer of raw binary data, which can be used in various WebGPU operations. Provides a mechanism to work directly with raw memory for performance-critical computations or data manipulation when working with GPU resources.
This class is an abstraction for handling binary data in a format compatible with WebGPU, allowing interoperability with GPU resources like buffers and textures.
## Sizes and capacities
Public sizes stay [`ULong`](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-u-long/index.html). For this increment each implementation caps its logical capacity at [`Int.MAX_VALUE`](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/-companion/-m-a-x_-v-a-l-u-e.html) bytes on Web, Android and Native, and [`Long.MAX_VALUE`](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/-companion/-m-a-x_-v-a-l-u-e.html) bytes on the JVM. These limits describe the current representations, not the platforms' theoretical capacities, and do not promise that an allocation succeeds. An allocation or wrapping size that is not representable is rejected with [`IllegalArgumentException`](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html); a real allocation failure surfaces as the platform error.
## Validation order
An access validates its range, then the alignment of a non-empty operation, then the numeric conversion, and only then touches memory. An out-of-range access throws [`IndexOutOfBoundsException`](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html); an unaligned offset, a size not divisible by the element width, or an element count too large for a Kotlin array throws [`IllegalArgumentException`](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html). Size multiplications are computed in a wide type after a `count <= maximum / width` check.
A zero-length operation at `offset == size` is valid and one past it fails. Empty operations never dereference a pointer and never create a typed view that would require alignment, so `allocate(0uL)` and `of(emptyArray)` work on every target. A write rejected by these preconditions leaves the whole memory unchanged; this is not a transactional guarantee against concurrent external changes. The checks only cover the declared range: an external pointer must still designate a real, large enough and live memory region.
=== "android"
Represents a platform-specific abstraction for handling raw binary data buffers.
`ArrayBuffer` is a sealed interface that provides a common type for working with binary data across multiple platforms. It is typically associated with use cases such as data transfer, WebGPU operations, or interfacing with native libraries.
This interface is intended to be implemented by platform-specific classes or value types that wrap the underlying buffer implementation, such as direct `ByteBuffer` on Android.
Example usage:
=== "jvm"
Represents a platform-specific abstraction for handling raw binary data buffers.
`ArrayBuffer` is a sealed interface that provides a common type for working with binary data across multiple platforms. It is typically associated with use cases such as data transfer, WebGPU operations, or interfacing with native libraries.
This interface is intended to be implemented by platform-specific classes or value types that wrap the underlying buffer implementation, such as `ByteBuffer` on JVM or `org.khronos.webgl.ArrayBuffer` on JavaScript or Wasm.
=== "native"
Represents a platform-specific abstraction over raw binary data stored in an ArrayBuffer.
This interface provides a unified way to interact with binary data across platforms, allowing efficient manipulation and processing of raw buffers. It is primarily used in contexts where native interop or web functionalities like WebGPU and WebGL require a representation of binary buffers.
Implementations of this interface may vary depending on the target platform, such as browser environments or native environments. They typically map to platform-native concepts like `org.khronos.webgl.ArrayBuffer` in JavaScript or analogous native structures in other environments.
Intended for use with platform-specific operations where binary data transfer or manipulation is necessary.
=== "web"
A platform-independent representation of a fixed-length raw binary data buffer.
The `ArrayBuffer` interface provides the ability to efficiently handle and store binary data in memory, often as the underlying storage for typed arrays. It is immutable, meaning its size cannot be adjusted once created.
This abstraction is commonly used for processing low-level binary data, enabling tasks such as file handling, network communication, or interfacing with Web APIs that require binary data storage.
=== "jvm, android, web, native"
#### Inheritors
- [`AndroidArrayBuffer`](../-android-array-buffer/index.md)
- [`JvmArrayBuffer`](../-jvm-array-buffer/index.md)
- [`OpaquePointerArrayBuffer`](../-opaque-pointer-array-buffer/index.md)
- [`WebArrayBuffer`](../-web-array-buffer/index.md)
expect sealed interface ArrayBuffer
actual interface ArrayBuffer
val buffer = ArrayBuffer.from(byteArrayOf(1, 2, 3, 4))
val intBuffer = ArrayBuffer.from(intArrayOf(100, 200, 300))
actual interface ArrayBuffer
actual interface ArrayBuffer
actual interface ArrayBuffer
Types¶
Companion¶
Properties¶
size¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
The size of the buffer in bytes.
=== "android"
The size of the buffer in bytes.
=== "jvm"
The size of the buffer in bytes.
=== "native"
The size of the buffer in bytes.
=== "web"
The size of the buffer in bytes.
Functions¶
getByte¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Reads a byte at the specified offset.
**Return**
the byte value
=== "android"
Reads a byte at the specified offset.
**Return**
the byte value
=== "jvm"
Reads a byte at the specified offset.
**Return**
the byte value
=== "native"
Reads a byte at the specified offset.
**Return**
the byte value
=== "web"
Reads a byte at the specified offset.
**Return**
the byte value
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset
- offset: the byte offset
- offset: the byte offset
- offset: the byte offset
- offset: the byte offset
getDouble¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Reads a double at the specified offset.
**Return**
the double value
=== "android"
Reads a double at the specified offset.
**Return**
the double value
=== "jvm"
Reads a double at the specified offset.
**Return**
the double value
=== "native"
Reads a double at the specified offset.
**Return**
the double value
=== "web"
Reads a double at the specified offset.
**Return**
the double value
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 8 bytes)
- offset: the byte offset (must be aligned to 8 bytes)
- offset: the byte offset (must be aligned to 8 bytes)
- offset: the byte offset (must be aligned to 8 bytes)
- offset: the byte offset (must be aligned to 8 bytes)
getFloat¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Reads a float at the specified offset.
**Return**
the float value
=== "android"
Reads a float at the specified offset.
**Return**
the float value
=== "jvm"
Reads a float at the specified offset.
**Return**
the float value
=== "native"
Reads a float at the specified offset.
**Return**
the float value
=== "web"
Reads a float at the specified offset.
**Return**
the float value
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
getInt¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Reads an int at the specified offset.
**Return**
the int value
=== "android"
Reads an int at the specified offset.
**Return**
the int value
=== "jvm"
Reads an int at the specified offset.
**Return**
the int value
=== "native"
Reads an int at the specified offset.
**Return**
the int value
=== "web"
Reads an int at the specified offset.
**Return**
the int value
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
getShort¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Reads a short at the specified offset.
**Return**
the short value
=== "android"
Reads a short at the specified offset.
**Return**
the short value
=== "jvm"
Reads a short at the specified offset.
**Return**
the short value
=== "native"
Reads a short at the specified offset.
**Return**
the short value
=== "web"
Reads a short at the specified offset.
**Return**
the short value
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 2 bytes)
- offset: the byte offset (must be aligned to 2 bytes)
- offset: the byte offset (must be aligned to 2 bytes)
- offset: the byte offset (must be aligned to 2 bytes)
- offset: the byte offset (must be aligned to 2 bytes)
getUByte¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Reads an unsigned byte at the specified offset.
**Return**
the unsigned byte value
=== "android"
Reads an unsigned byte at the specified offset.
**Return**
the unsigned byte value
=== "jvm"
Reads an unsigned byte at the specified offset.
**Return**
the unsigned byte value
=== "native"
Reads an unsigned byte at the specified offset.
**Return**
the unsigned byte value
=== "web"
Reads an unsigned byte at the specified offset.
**Return**
the unsigned byte value
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset
- offset: the byte offset
- offset: the byte offset
- offset: the byte offset
- offset: the byte offset
getUInt¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Reads an unsigned int at the specified offset.
**Return**
the unsigned int value
=== "android"
Reads an unsigned int at the specified offset.
**Return**
the unsigned int value
=== "jvm"
Reads an unsigned int at the specified offset.
**Return**
the unsigned int value
=== "native"
Reads an unsigned int at the specified offset.
**Return**
the unsigned int value
=== "web"
Reads an unsigned int at the specified offset.
**Return**
the unsigned int value
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
- offset: the byte offset (must be aligned to 4 bytes)
getUShort¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Reads an unsigned short at the specified offset.
**Return**
the unsigned short value
=== "android"
Reads an unsigned short at the specified offset.
**Return**
the unsigned short value
=== "jvm"
Reads an unsigned short at the specified offset.
**Return**
the unsigned short value
=== "native"
Reads an unsigned short at the specified offset.
**Return**
the unsigned short value
=== "web"
Reads an unsigned short at the specified offset.
**Return**
the unsigned short value
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 2 bytes)
- offset: the byte offset (must be aligned to 2 bytes)
- offset: the byte offset (must be aligned to 2 bytes)
- offset: the byte offset (must be aligned to 2 bytes)
- offset: the byte offset (must be aligned to 2 bytes)
setByte¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Writes a byte at the specified offset.
=== "android"
Writes a byte at the specified offset.
=== "jvm"
Writes a byte at the specified offset.
=== "native"
Writes a byte at the specified offset.
=== "web"
Writes a byte at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset
- value: the byte value to write
- offset: the byte offset
- value: the byte value to write
- offset: the byte offset
- value: the byte value to write
- offset: the byte offset
- value: the byte value to write
- offset: the byte offset
- value: the byte value to write
setBytes¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Writes a ByteArray into the buffer at the specified offset.
=== "android"
Writes a ByteArray into the buffer at the specified offset.
=== "jvm"
Writes a ByteArray into the buffer at the specified offset.
=== "native"
Writes a ByteArray into the buffer at the specified offset.
=== "web"
Writes a ByteArray into the buffer at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset where to start writing
- array: the byte array to write
- offset: the byte offset where to start writing
- array: the byte array to write
- offset: the byte offset where to start writing
- array: the byte array to write
- offset: the byte offset where to start writing
- array: the byte array to write
- offset: the byte offset where to start writing
- array: the byte array to write
setDouble¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Writes a double at the specified offset.
=== "android"
Writes a double at the specified offset.
=== "jvm"
Writes a double at the specified offset.
=== "native"
Writes a double at the specified offset.
=== "web"
Writes a double at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 8 bytes)
- value: the double value to write
- offset: the byte offset (must be aligned to 8 bytes)
- value: the double value to write
- offset: the byte offset (must be aligned to 8 bytes)
- value: the double value to write
- offset: the byte offset (must be aligned to 8 bytes)
- value: the double value to write
- offset: the byte offset (must be aligned to 8 bytes)
- value: the double value to write
setDoubles¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun setDoubles(offset: ULong, array: DoubleArray)
actual abstract fun setDoubles(offset: ULong, array: DoubleArray)
actual abstract fun setDoubles(offset: ULong, array: DoubleArray)
actual abstract fun setDoubles(offset: ULong, array: DoubleArray)
actual abstract fun setDoubles(offset: ULong, array: DoubleArray)
=== "common"
Writes a DoubleArray into the buffer at the specified offset.
=== "android"
Writes a DoubleArray into the buffer at the specified offset.
=== "jvm"
Writes a DoubleArray into the buffer at the specified offset.
=== "native"
Writes a DoubleArray into the buffer at the specified offset.
=== "web"
Writes a DoubleArray into the buffer at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset where to start writing (must be aligned to 8 bytes)
- array: the double array to write
- offset: the byte offset where to start writing (must be aligned to 8 bytes)
- array: the double array to write
- offset: the byte offset where to start writing (must be aligned to 8 bytes)
- array: the double array to write
- offset: the byte offset where to start writing (must be aligned to 8 bytes)
- array: the double array to write
- offset: the byte offset where to start writing (must be aligned to 8 bytes)
- array: the double array to write
setFloat¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Writes a float at the specified offset.
=== "android"
Writes a float at the specified offset.
=== "jvm"
Writes a float at the specified offset.
=== "native"
Writes a float at the specified offset.
=== "web"
Writes a float at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 4 bytes)
- value: the float value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the float value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the float value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the float value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the float value to write
setFloats¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun setFloats(offset: ULong, array: FloatArray)
actual abstract fun setFloats(offset: ULong, array: FloatArray)
actual abstract fun setFloats(offset: ULong, array: FloatArray)
actual abstract fun setFloats(offset: ULong, array: FloatArray)
actual abstract fun setFloats(offset: ULong, array: FloatArray)
=== "common"
Writes a FloatArray into the buffer at the specified offset.
=== "android"
Writes a FloatArray into the buffer at the specified offset.
=== "jvm"
Writes a FloatArray into the buffer at the specified offset.
=== "native"
Writes a FloatArray into the buffer at the specified offset.
=== "web"
Writes a FloatArray into the buffer at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the float array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the float array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the float array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the float array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the float array to write
setInt¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Writes an int at the specified offset.
=== "android"
Writes an int at the specified offset.
=== "jvm"
Writes an int at the specified offset.
=== "native"
Writes an int at the specified offset.
=== "web"
Writes an int at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 4 bytes)
- value: the int value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the int value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the int value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the int value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the int value to write
setInts¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Writes an IntArray into the buffer at the specified offset.
=== "android"
Writes an IntArray into the buffer at the specified offset.
=== "jvm"
Writes an IntArray into the buffer at the specified offset.
=== "native"
Writes an IntArray into the buffer at the specified offset.
=== "web"
Writes an IntArray into the buffer at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the int array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the int array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the int array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the int array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the int array to write
setShort¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Writes a short at the specified offset.
=== "android"
Writes a short at the specified offset.
=== "jvm"
Writes a short at the specified offset.
=== "native"
Writes a short at the specified offset.
=== "web"
Writes a short at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 2 bytes)
- value: the short value to write
- offset: the byte offset (must be aligned to 2 bytes)
- value: the short value to write
- offset: the byte offset (must be aligned to 2 bytes)
- value: the short value to write
- offset: the byte offset (must be aligned to 2 bytes)
- value: the short value to write
- offset: the byte offset (must be aligned to 2 bytes)
- value: the short value to write
setShorts¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun setShorts(offset: ULong, array: ShortArray)
actual abstract fun setShorts(offset: ULong, array: ShortArray)
actual abstract fun setShorts(offset: ULong, array: ShortArray)
actual abstract fun setShorts(offset: ULong, array: ShortArray)
actual abstract fun setShorts(offset: ULong, array: ShortArray)
=== "common"
Writes a ShortArray into the buffer at the specified offset.
=== "android"
Writes a ShortArray into the buffer at the specified offset.
=== "jvm"
Writes a ShortArray into the buffer at the specified offset.
=== "native"
Writes a ShortArray into the buffer at the specified offset.
=== "web"
Writes a ShortArray into the buffer at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset where to start writing (must be aligned to 2 bytes)
- array: the short array to write
- offset: the byte offset where to start writing (must be aligned to 2 bytes)
- array: the short array to write
- offset: the byte offset where to start writing (must be aligned to 2 bytes)
- array: the short array to write
- offset: the byte offset where to start writing (must be aligned to 2 bytes)
- array: the short array to write
- offset: the byte offset where to start writing (must be aligned to 2 bytes)
- array: the short array to write
setUByte¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Writes an unsigned byte at the specified offset.
=== "android"
Writes an unsigned byte at the specified offset.
=== "jvm"
Writes an unsigned byte at the specified offset.
=== "native"
Writes an unsigned byte at the specified offset.
=== "web"
Writes an unsigned byte at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset
- value: the unsigned byte value to write
- offset: the byte offset
- value: the unsigned byte value to write
- offset: the byte offset
- value: the unsigned byte value to write
- offset: the byte offset
- value: the unsigned byte value to write
- offset: the byte offset
- value: the unsigned byte value to write
setUBytes¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun setUBytes(offset: ULong, array: UByteArray)
actual abstract fun setUBytes(offset: ULong, array: UByteArray)
actual abstract fun setUBytes(offset: ULong, array: UByteArray)
actual abstract fun setUBytes(offset: ULong, array: UByteArray)
actual abstract fun setUBytes(offset: ULong, array: UByteArray)
=== "common"
Writes a UByteArray into the buffer at the specified offset.
=== "android"
Writes a UByteArray into the buffer at the specified offset.
=== "jvm"
Writes a UByteArray into the buffer at the specified offset.
=== "native"
Writes a UByteArray into the buffer at the specified offset.
=== "web"
Writes a UByteArray into the buffer at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset where to start writing
- array: the unsigned byte array to write
- offset: the byte offset where to start writing
- array: the unsigned byte array to write
- offset: the byte offset where to start writing
- array: the unsigned byte array to write
- offset: the byte offset where to start writing
- array: the unsigned byte array to write
- offset: the byte offset where to start writing
- array: the unsigned byte array to write
setUInt¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Writes an unsigned int at the specified offset.
=== "android"
Writes an unsigned int at the specified offset.
=== "jvm"
Writes an unsigned int at the specified offset.
=== "native"
Writes an unsigned int at the specified offset.
=== "web"
Writes an unsigned int at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 4 bytes)
- value: the unsigned int value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the unsigned int value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the unsigned int value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the unsigned int value to write
- offset: the byte offset (must be aligned to 4 bytes)
- value: the unsigned int value to write
setUInts¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Writes a UIntArray into the buffer at the specified offset.
=== "android"
Writes a UIntArray into the buffer at the specified offset.
=== "jvm"
Writes a UIntArray into the buffer at the specified offset.
=== "native"
Writes a UIntArray into the buffer at the specified offset.
=== "web"
Writes a UIntArray into the buffer at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the unsigned int array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the unsigned int array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the unsigned int array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the unsigned int array to write
- offset: the byte offset where to start writing (must be aligned to 4 bytes)
- array: the unsigned int array to write
setUShort¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
=== "common"
Writes an unsigned short at the specified offset.
=== "android"
Writes an unsigned short at the specified offset.
=== "jvm"
Writes an unsigned short at the specified offset.
=== "native"
Writes an unsigned short at the specified offset.
=== "web"
Writes an unsigned short at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset (must be aligned to 2 bytes)
- value: the unsigned short value to write
- offset: the byte offset (must be aligned to 2 bytes)
- value: the unsigned short value to write
- offset: the byte offset (must be aligned to 2 bytes)
- value: the unsigned short value to write
- offset: the byte offset (must be aligned to 2 bytes)
- value: the unsigned short value to write
- offset: the byte offset (must be aligned to 2 bytes)
- value: the unsigned short value to write
setUShorts¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun setUShorts(offset: ULong, array: UShortArray)
actual abstract fun setUShorts(offset: ULong, array: UShortArray)
actual abstract fun setUShorts(offset: ULong, array: UShortArray)
actual abstract fun setUShorts(offset: ULong, array: UShortArray)
actual abstract fun setUShorts(offset: ULong, array: UShortArray)
=== "common"
Writes a UShortArray into the buffer at the specified offset.
=== "android"
Writes a UShortArray into the buffer at the specified offset.
=== "jvm"
Writes a UShortArray into the buffer at the specified offset.
=== "native"
Writes a UShortArray into the buffer at the specified offset.
=== "web"
Writes a UShortArray into the buffer at the specified offset.
=== "common, android, jvm, native, web"
**Parameters**
- offset: the byte offset where to start writing (must be aligned to 2 bytes)
- array: the unsigned short array to write
- offset: the byte offset where to start writing (must be aligned to 2 bytes)
- array: the unsigned short array to write
- offset: the byte offset where to start writing (must be aligned to 2 bytes)
- array: the unsigned short array to write
- offset: the byte offset where to start writing (must be aligned to 2 bytes)
- array: the unsigned short array to write
- offset: the byte offset where to start writing (must be aligned to 2 bytes)
- array: the unsigned short array to write
toByteArray¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun toByteArray(): ByteArray
actual abstract fun toByteArray(): ByteArray
actual abstract fun toByteArray(): ByteArray
actual abstract fun toByteArray(): ByteArray
actual abstract fun toByteArray(): ByteArray
=== "common"
Converts the buffer to a ByteArray.
**Return**
a ByteArray containing the buffer's data
=== "android"
Converts the buffer to a ByteArray.
**Return**
a ByteArray containing the buffer's data
=== "jvm"
Converts the buffer to a ByteArray.
**Return**
a ByteArray containing the buffer's data
=== "native"
Converts the buffer to a ByteArray.
**Return**
a ByteArray containing the buffer's data
=== "web"
Converts the buffer to a ByteArray.
**Return**
a ByteArray containing the buffer's data
toDoubleArray¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun toDoubleArray(): DoubleArray
actual abstract fun toDoubleArray(): DoubleArray
actual abstract fun toDoubleArray(): DoubleArray
actual abstract fun toDoubleArray(): DoubleArray
actual abstract fun toDoubleArray(): DoubleArray
=== "common"
Converts the buffer to a DoubleArray.
**Return**
a DoubleArray containing the buffer's data (size must be multiple of 8)
=== "android"
Converts the buffer to a DoubleArray.
**Return**
a DoubleArray containing the buffer's data (size must be multiple of 8)
=== "jvm"
Converts the buffer to a DoubleArray.
**Return**
a DoubleArray containing the buffer's data (size must be multiple of 8)
=== "native"
Converts the buffer to a DoubleArray.
**Return**
a DoubleArray containing the buffer's data (size must be multiple of 8)
=== "web"
Converts the buffer to a DoubleArray.
**Return**
a DoubleArray containing the buffer's data (size must be multiple of 8)
toFloatArray¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun toFloatArray(): FloatArray
actual abstract fun toFloatArray(): FloatArray
actual abstract fun toFloatArray(): FloatArray
actual abstract fun toFloatArray(): FloatArray
actual abstract fun toFloatArray(): FloatArray
=== "common"
Converts the buffer to a FloatArray.
**Return**
a FloatArray containing the buffer's data (size must be multiple of 4)
=== "android"
Converts the buffer to a FloatArray.
**Return**
a FloatArray containing the buffer's data (size must be multiple of 4)
=== "jvm"
Converts the buffer to a FloatArray.
**Return**
a FloatArray containing the buffer's data (size must be multiple of 4)
=== "native"
Converts the buffer to a FloatArray.
**Return**
a FloatArray containing the buffer's data (size must be multiple of 4)
=== "web"
Converts the buffer to a FloatArray.
**Return**
a FloatArray containing the buffer's data (size must be multiple of 4)
toIntArray¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun toIntArray(): IntArray
actual abstract fun toIntArray(): IntArray
actual abstract fun toIntArray(): IntArray
actual abstract fun toIntArray(): IntArray
actual abstract fun toIntArray(): IntArray
=== "common"
Converts the buffer to an IntArray.
**Return**
an IntArray containing the buffer's data (size must be multiple of 4)
=== "android"
Converts the buffer to an IntArray.
**Return**
an IntArray containing the buffer's data (size must be multiple of 4)
=== "jvm"
Converts the buffer to an IntArray.
**Return**
an IntArray containing the buffer's data (size must be multiple of 4)
=== "native"
Converts the buffer to an IntArray.
**Return**
an IntArray containing the buffer's data (size must be multiple of 4)
=== "web"
Converts the buffer to an IntArray.
**Return**
an IntArray containing the buffer's data (size must be multiple of 4)
toShortArray¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun toShortArray(): ShortArray
actual abstract fun toShortArray(): ShortArray
actual abstract fun toShortArray(): ShortArray
actual abstract fun toShortArray(): ShortArray
actual abstract fun toShortArray(): ShortArray
=== "common"
Converts the buffer to a ShortArray.
**Return**
a ShortArray containing the buffer's data (size must be multiple of 2)
=== "android"
Converts the buffer to a ShortArray.
**Return**
a ShortArray containing the buffer's data (size must be multiple of 2)
=== "jvm"
Converts the buffer to a ShortArray.
**Return**
a ShortArray containing the buffer's data (size must be multiple of 2)
=== "native"
Converts the buffer to a ShortArray.
**Return**
a ShortArray containing the buffer's data (size must be multiple of 2)
=== "web"
Converts the buffer to a ShortArray.
**Return**
a ShortArray containing the buffer's data (size must be multiple of 2)
toUByteArray¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun toUByteArray(): UByteArray
actual abstract fun toUByteArray(): UByteArray
actual abstract fun toUByteArray(): UByteArray
actual abstract fun toUByteArray(): UByteArray
actual abstract fun toUByteArray(): UByteArray
=== "common"
Converts the buffer to a UByteArray.
**Return**
a UByteArray containing the buffer's data
=== "android"
Converts the buffer to a UByteArray.
**Return**
a UByteArray containing the buffer's data
=== "jvm"
Converts the buffer to a UByteArray.
**Return**
a UByteArray containing the buffer's data
=== "native"
Converts the buffer to a UByteArray.
**Return**
a UByteArray containing the buffer's data
=== "web"
Converts the buffer to a UByteArray.
**Return**
a UByteArray containing the buffer's data
toUIntArray¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun toUIntArray(): UIntArray
actual abstract fun toUIntArray(): UIntArray
actual abstract fun toUIntArray(): UIntArray
actual abstract fun toUIntArray(): UIntArray
actual abstract fun toUIntArray(): UIntArray
=== "common"
Converts the buffer to a UIntArray.
**Return**
a UIntArray containing the buffer's data (size must be multiple of 4)
=== "android"
Converts the buffer to a UIntArray.
**Return**
a UIntArray containing the buffer's data (size must be multiple of 4)
=== "jvm"
Converts the buffer to a UIntArray.
**Return**
a UIntArray containing the buffer's data (size must be multiple of 4)
=== "native"
Converts the buffer to a UIntArray.
**Return**
a UIntArray containing the buffer's data (size must be multiple of 4)
=== "web"
Converts the buffer to a UIntArray.
**Return**
a UIntArray containing the buffer's data (size must be multiple of 4)
toUShortArray¶
=== "common"
=== "android"
=== "jvm"
=== "native"
=== "web"
expect abstract fun toUShortArray(): UShortArray
actual abstract fun toUShortArray(): UShortArray
actual abstract fun toUShortArray(): UShortArray
actual abstract fun toUShortArray(): UShortArray
actual abstract fun toUShortArray(): UShortArray
=== "common"
Converts the buffer to a UShortArray.
**Return**
a UShortArray containing the buffer's data (size must be multiple of 2)
=== "android"
Converts the buffer to a UShortArray.
**Return**
a UShortArray containing the buffer's data (size must be multiple of 2)
=== "jvm"
Converts the buffer to a UShortArray.
**Return**
a UShortArray containing the buffer's data (size must be multiple of 2)
=== "native"
Converts the buffer to a UShortArray.
**Return**
a UShortArray containing the buffer's data (size must be multiple of 2)
=== "web"
Converts the buffer to a UShortArray.
**Return**
a UShortArray containing the buffer's data (size must be multiple of 2)