MutableData

class MutableData(capacity: Int = 16)(source)

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

Since Kotlin

1.3

Constructors

Link copied to clipboard
constructor(capacity: Int = 16)

Properties

Link copied to clipboard
val size: Int

Current data size, may concurrently change later on.

Since Kotlin 1.3

Functions

Link copied to clipboard
fun append(data: MutableData)

Appends data to the buffer.

Since Kotlin 1.3
fun append(data: COpaquePointer?, count: Int)

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

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

Appends byte array to the buffer.

Since Kotlin 1.3
Link copied to clipboard
fun copyInto(output: ByteArray, destinationIndex: Int, startIndex: Int, endIndex: Int)

Copies range of mutable data to the byte array.

Since Kotlin 1.3
Link copied to clipboard
operator fun get(index: Int): Byte

Get a byte from the mutable data.

Since Kotlin 1.3
Link copied to clipboard
fun reset()

Reset the data buffer, makings its size 0.

Since Kotlin 1.3
Link copied to clipboard
fun <R> withBufferLocked(block: (array: ByteArray, dataSize: Int) -> R): R

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

Since Kotlin 1.3
Link copied to clipboard
fun <R> withPointerLocked(block: (COpaquePointer, dataSize: Int) -> R): R

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.

Since Kotlin 1.3