MutableData

Native
1.3
class MutableData
(source)

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

Constructors

Native
1.3

<init>

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

MutableData(capacity: Int = 16)

Properties

Native
1.3

size

Current data size, may concurrently change later on.

val size: Int

Functions

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)
Native
1.3

copyInto

Copies range of mutable data to the byte array.

fun copyInto(
    output: ByteArray,
    destinationIndex: Int,
    startIndex: Int,
    endIndex: Int)
Native
1.3

get

Get a byte from the mutable data.

operator fun get(index: Int): Byte
Native
1.3

reset

Reset the data buffer, makings its size 0.

fun reset()
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
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