MutableData
Mutable concurrently accessible data buffer. Could be accessed from several workers simultaneously.
Constructors
<init>
Mutable concurrently accessible data buffer. Could be accessed from several workers simultaneously.
MutableData
(
capacity
:
Int
=
16
)
Properties
size
Current data size, may concurrently change later on.
val
size
:
Int
Functions
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
)
copyInto
Copies range of mutable data to the byte array.
fun
copyInto
(
output
:
ByteArray
,
destinationIndex
:
Int
,
startIndex
:
Int
,
endIndex
:
Int
)
get
Get a byte from the mutable data.
operator
fun
get
(
index
:
Int
)
:
Byte
reset
Reset the data buffer, makings its size 0.
fun
reset
(
)
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
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