Aller au contenu

Companion

=== "common"
expect object Companion
    
=== "android"
actual object Companion
    
=== "jvm"
actual object Companion
    
=== "native"
actual object Companion
    
=== "web"
actual object Companion
    

Functions

allocate

=== "common"
expect fun allocate(sizeInBytes: ULong): ArrayBuffer
    
=== "android"
actual fun allocate(sizeInBytes: ULong): ArrayBuffer
    
=== "jvm"
actual fun allocate(sizeInBytes: ULong): ArrayBuffer
    
=== "native"
actual fun allocate(sizeInBytes: ULong): ArrayBuffer
    
=== "web"
actual fun allocate(sizeInBytes: ULong): ArrayBuffer
    
=== "common" Allocates a new ArrayBuffer with the specified size in bytes. The buffer is zero-initialized and memory is managed automatically. **Return** a new ArrayBuffer with the specified size === "android" Allocates a new ArrayBuffer with the specified size in bytes. The buffer is zero-initialized and memory is managed automatically. **Return** a new ArrayBuffer with the specified size === "jvm" Allocates a new ArrayBuffer with the specified size in bytes. The buffer is zero-initialized and memory is managed automatically. **Return** a new ArrayBuffer with the specified size === "native" Allocates a new ArrayBuffer with the specified size in bytes. The buffer is zero-initialized and memory is managed automatically. **Return** a new ArrayBuffer with the specified size === "web" Allocates a new ArrayBuffer with the specified size in bytes. The buffer is zero-initialized and memory is managed automatically. **Return** a new ArrayBuffer with the specified size === "common, android, jvm, native, web" **Parameters** - sizeInBytes: the size of the buffer in bytes - sizeInBytes: the size of the buffer in bytes - sizeInBytes: the size of the buffer in bytes - sizeInBytes: the size of the buffer in bytes - sizeInBytes: the size of the buffer in bytes

of

=== "common"
expect fun of(array: ByteArray): ArrayBuffer
    
=== "android"
actual fun of(array: ByteArray): ArrayBuffer
    
=== "jvm"
actual fun of(array: ByteArray): ArrayBuffer
    
=== "native"
actual fun of(array: ByteArray): ArrayBuffer
    
=== "web"
actual fun of(array: ByteArray): ArrayBuffer
    
=== "common" Creates an ArrayBuffer from a ByteArray. **Return** an ArrayBuffer containing the data from the byte array === "android" Creates an ArrayBuffer from a ByteArray. **Return** an ArrayBuffer containing the data from the byte array === "jvm" Creates an ArrayBuffer from a ByteArray. **Return** an ArrayBuffer containing the data from the byte array === "native" Creates an ArrayBuffer from a ByteArray. **Return** an ArrayBuffer containing the data from the byte array === "web" Creates an ArrayBuffer from a ByteArray. **Return** an ArrayBuffer containing the data from the byte array === "common, android, jvm, native, web" **Parameters** - array: the byte array to convert - array: the byte array to convert - array: the byte array to convert - array: the byte array to convert - array: the byte array to convert
=== "common"
expect fun of(array: ShortArray): ArrayBuffer
    
=== "android"
actual fun of(array: ShortArray): ArrayBuffer
    
=== "jvm"
actual fun of(array: ShortArray): ArrayBuffer
    
=== "native"
actual fun of(array: ShortArray): ArrayBuffer
    
=== "web"
actual fun of(array: ShortArray): ArrayBuffer
    
=== "common" Creates an ArrayBuffer from a ShortArray. **Return** an ArrayBuffer containing the data from the short array === "android" Creates an ArrayBuffer from a ShortArray. **Return** an ArrayBuffer containing the data from the short array === "jvm" Creates an ArrayBuffer from a ShortArray. **Return** an ArrayBuffer containing the data from the short array === "native" Creates an ArrayBuffer from a ShortArray. **Return** an ArrayBuffer containing the data from the short array === "web" Creates an ArrayBuffer from a ShortArray. **Return** an ArrayBuffer containing the data from the short array === "common, android, jvm, native, web" **Parameters** - array: the short array to convert - array: the short array to convert - array: the short array to convert - array: the short array to convert - array: the short array to convert
=== "common"
expect fun of(array: IntArray): ArrayBuffer
    
=== "android"
actual fun of(array: IntArray): ArrayBuffer
    
=== "jvm"
actual fun of(array: IntArray): ArrayBuffer
    
=== "native"
actual fun of(array: IntArray): ArrayBuffer
    
=== "web"
actual fun of(array: IntArray): ArrayBuffer
    
=== "common" Creates an ArrayBuffer from an IntArray. **Return** an ArrayBuffer containing the data from the int array === "android" Creates an ArrayBuffer from an IntArray. **Return** an ArrayBuffer containing the data from the int array === "jvm" Creates an ArrayBuffer from an IntArray. **Return** an ArrayBuffer containing the data from the int array === "native" Creates an ArrayBuffer from an IntArray. **Return** an ArrayBuffer containing the data from the int array === "web" Creates an ArrayBuffer from an IntArray. **Return** an ArrayBuffer containing the data from the int array === "common, android, jvm, native, web" **Parameters** - array: the int array to convert - array: the int array to convert - array: the int array to convert - array: the int array to convert - array: the int array to convert
=== "common"
expect fun of(array: FloatArray): ArrayBuffer
    
=== "android"
actual fun of(array: FloatArray): ArrayBuffer
    
=== "jvm"
actual fun of(array: FloatArray): ArrayBuffer
    
=== "native"
actual fun of(array: FloatArray): ArrayBuffer
    
=== "web"
actual fun of(array: FloatArray): ArrayBuffer
    
=== "common" Creates an ArrayBuffer from a FloatArray. **Return** an ArrayBuffer containing the data from the float array === "android" Creates an ArrayBuffer from a FloatArray. **Return** an ArrayBuffer containing the data from the float array === "jvm" Creates an ArrayBuffer from a FloatArray. **Return** an ArrayBuffer containing the data from the float array === "native" Creates an ArrayBuffer from a FloatArray. **Return** an ArrayBuffer containing the data from the float array === "web" Creates an ArrayBuffer from a FloatArray. **Return** an ArrayBuffer containing the data from the float array === "common, android, jvm, native, web" **Parameters** - array: the float array to convert - array: the float array to convert - array: the float array to convert - array: the float array to convert - array: the float array to convert
=== "common"
expect fun of(array: DoubleArray): ArrayBuffer
    
=== "android"
actual fun of(array: DoubleArray): ArrayBuffer
    
=== "jvm"
actual fun of(array: DoubleArray): ArrayBuffer
    
=== "native"
actual fun of(array: DoubleArray): ArrayBuffer
    
=== "web"
actual fun of(array: DoubleArray): ArrayBuffer
    
=== "common" Creates an ArrayBuffer from a DoubleArray. **Return** an ArrayBuffer containing the data from the double array === "android" Creates an ArrayBuffer from a DoubleArray. **Return** an ArrayBuffer containing the data from the double array === "jvm" Creates an ArrayBuffer from a DoubleArray. **Return** an ArrayBuffer containing the data from the double array === "native" Creates an ArrayBuffer from a DoubleArray. **Return** an ArrayBuffer containing the data from the double array === "web" Creates an ArrayBuffer from a DoubleArray. **Return** an ArrayBuffer containing the data from the double array === "common, android, jvm, native, web" **Parameters** - array: the double array to convert - array: the double array to convert - array: the double array to convert - array: the double array to convert - array: the double array to convert
=== "common"
expect fun of(array: UByteArray): ArrayBuffer
    
=== "android"
actual fun of(array: UByteArray): ArrayBuffer
    
=== "jvm"
actual fun of(array: UByteArray): ArrayBuffer
    
=== "native"
actual fun of(array: UByteArray): ArrayBuffer
    
=== "web"
actual fun of(array: UByteArray): ArrayBuffer
    
=== "common" Creates an ArrayBuffer from a UByteArray. **Return** an ArrayBuffer containing the data from the unsigned byte array === "android" Creates an ArrayBuffer from a UByteArray. **Return** an ArrayBuffer containing the data from the unsigned byte array === "jvm" Creates an ArrayBuffer from a UByteArray. **Return** an ArrayBuffer containing the data from the unsigned byte array === "native" Creates an ArrayBuffer from a UByteArray. **Return** an ArrayBuffer containing the data from the unsigned byte array === "web" Creates an ArrayBuffer from a UByteArray. **Return** an ArrayBuffer containing the data from the unsigned byte array === "common, android, jvm, native, web" **Parameters** - array: the unsigned byte array to convert - array: the unsigned byte array to convert - array: the unsigned byte array to convert - array: the unsigned byte array to convert - array: the unsigned byte array to convert
=== "common"
expect fun of(array: UShortArray): ArrayBuffer
    
=== "android"
actual fun of(array: UShortArray): ArrayBuffer
    
=== "jvm"
actual fun of(array: UShortArray): ArrayBuffer
    
=== "native"
actual fun of(array: UShortArray): ArrayBuffer
    
=== "web"
actual fun of(array: UShortArray): ArrayBuffer
    
=== "common" Creates an ArrayBuffer from a UShortArray. **Return** an ArrayBuffer containing the data from the unsigned short array === "android" Creates an ArrayBuffer from a UShortArray. **Return** an ArrayBuffer containing the data from the unsigned short array === "jvm" Creates an ArrayBuffer from a UShortArray. **Return** an ArrayBuffer containing the data from the unsigned short array === "native" Creates an ArrayBuffer from a UShortArray. **Return** an ArrayBuffer containing the data from the unsigned short array === "web" Creates an ArrayBuffer from a UShortArray. **Return** an ArrayBuffer containing the data from the unsigned short array === "common, android, jvm, native, web" **Parameters** - array: the unsigned short array to convert - array: the unsigned short array to convert - array: the unsigned short array to convert - array: the unsigned short array to convert - array: the unsigned short array to convert
=== "common"
expect fun of(array: UIntArray): ArrayBuffer
    
=== "android"
actual fun of(array: UIntArray): ArrayBuffer
    
=== "jvm"
actual fun of(array: UIntArray): ArrayBuffer
    
=== "native"
actual fun of(array: UIntArray): ArrayBuffer
    
=== "web"
actual fun of(array: UIntArray): ArrayBuffer
    
=== "common" Creates an ArrayBuffer from a UIntArray. **Return** an ArrayBuffer containing the data from the unsigned int array === "android" Creates an ArrayBuffer from a UIntArray. **Return** an ArrayBuffer containing the data from the unsigned int array === "jvm" Creates an ArrayBuffer from a UIntArray. **Return** an ArrayBuffer containing the data from the unsigned int array === "native" Creates an ArrayBuffer from a UIntArray. **Return** an ArrayBuffer containing the data from the unsigned int array === "web" Creates an ArrayBuffer from a UIntArray. **Return** an ArrayBuffer containing the data from the unsigned int array === "common, android, jvm, native, web" **Parameters** - array: the unsigned int array to convert - array: the unsigned int array to convert - array: the unsigned int array to convert - array: the unsigned int array to convert - array: the unsigned int array to convert

wrap

fun wrap(buffer: ByteBuffer): ArrayBuffer
Creates an ArrayBuffer from a ByteBuffer. **Return** an ArrayBuffer backed by the byte buffer **Parameters** - buffer: the byte buffer to wrap (must be a direct buffer)
fun wrap(address: Long, size: ULong): ArrayBuffer
Wraps borrowed native memory as an ArrayBuffer. The returned view reads and writes the memory at [`address`](index.md#wrap) directly, in the platform's native byte order: it never copies and never frees — the caller keeps owning the memory and must keep it valid for the view's whole lifetime. The intended use is a range a native library lends the caller for a bounded time, such as a GPU-mapped buffer between map and unmap. **Return** an ArrayBuffer view over the borrowed native memory **Parameters** - address: the native address of the borrowed memory (must not be null when [`size`](index.md#wrap) is non-zero) - size: the size of the borrowed range in bytes **Throws** [`IllegalStateException`](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html) : when a non-zero size is paired with a null address
Creates an ArrayBuffer from a MemorySegment. **Return** an ArrayBuffer backed by the memory segment **Parameters** - segment: the memory segment to wrap
Wraps a native pointer and its size into an OpaquePointerArrayBuffer. **Return** an instance of OpaquePointerArrayBuffer wrapping the provided pointer and size **Parameters** - pointer: the native pointer to wrap - size: the size of the buffer in bytes
fun wrap(buffer: ArrayBuffer): WebArrayBuffer
Creates an ArrayBuffer from a JavaScript ArrayBuffer. **Return** an ArrayBuffer backed by the JavaScript array buffer **Parameters** - buffer: the JavaScript array buffer to wrap