W3cubDocs

/Kotlin

MutableData

Platform and version requirements: Native (1.3)
class MutableData

Mutable concurrently accessible data buffer. Could be accessed from several workers simulteniously.

Constructors

Platform and version requirements: Native (1.3)

<init>

Mutable concurrently accessible data buffer. Could be accessed from several workers simulteniously.

MutableData(capacity: Int = 16)

Properties

Platform and version requirements: Native (1.3)

size

Current data size, may concurrently change later on.

val size: Int

Functions

Platform and version requirements: Native (1.3)

append

Appends data to the buffer.

fun append(data: MutableData)

Appends byte array to the buffer.

fun append(
    data: ByteArray, 
    fromIndex: Int = 0, 
    toIndex: Int = data.size)

Appends C data to the buffer, if data is null or count is non-positive - return.

fun append(data: COpaquePointer?, count: Int)
Platform and version requirements: Native (1.3)

copyInto

Copies range of mutable data to the byte array.

fun copyInto(
    output: ByteArray, 
    destinationIndex: Int, 
    startIndex: Int, 
    endIndex: Int)
Platform and version requirements: Native (1.3)

get

Get a byte from the mutable data.

operator fun get(index: Int): Byte
Platform and version requirements: Native (1.3)

reset

Reset the data buffer, makings its size 0.

fun reset()
Platform and version requirements: Native (1.3)

withBufferLocked

Executes provided block under lock with the raw data buffer. Block is executed under the spinlock, and must be short.

fun <R> withBufferLocked(
    block: (array: ByteArray, dataSize: Int) -> R
): R
Platform and version requirements: Native (1.3)

withPointerLocked

Executes provided block under lock with raw pointer to the data stored in the buffer. Block is executed under the spinlock, and must be short.

fun <R> withPointerLocked(
    block: (COpaquePointer, dataSize: Int) -> R
): R

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-mutable-data/index.html