expect class Memory
Represents a linear range of bytes. All operations are guarded by range-checks by default however at some platforms they could be disabled in release builds. |
fun Memory.copyTo(destination: ByteArray, offset: Int, length: Int): Unit fun Memory.copyTo(destination: ByteArray, offset: Long, length: Int): Unit
Copies bytes from this memory range from the specified offset and length to the destination. expect fun Memory.copyTo(destination: ByteArray, offset: Int, length: Int, destinationOffset: Int): Unit expect fun Memory.copyTo(destination: ByteArray, offset: Long, length: Int, destinationOffset: Int): Unit
Copies bytes from this memory range from the specified offset and length to the destination at destinationOffset. fun Memory.copyTo(destination: ByteBuffer, offset: Int): Unit fun Memory.copyTo(destination: ByteBuffer, offset: Long): Unit
Copies bytes from this memory range from the specified offset to the destination buffer. |
|
expect fun Memory.fill(offset: Long, count: Long, value: Byte): Unit expect fun Memory.fill(offset: Int, count: Int, value: Byte): Unit
Fill memory range starting at the specified offset with value repeated count times. |
|
operator fun Memory.get(index: Int): Byte operator fun Memory.get(index: Long): Byte
Read byte at the specified index. |
|
fun Memory.loadByteArray(offset: Int, destination: ByteArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit
Copies bytes from this memory range from the specified offset and count to the destination at destinationOffset. fun Memory.loadByteArray(offset: Long, destination: ByteArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit
Copies unsigned shorts integers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian). |
|
expect fun Memory.loadDoubleArray(offset: Int, destination: DoubleArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit expect fun Memory.loadDoubleArray(offset: Long, destination: DoubleArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit
Copies floating point numbers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian). |
|
expect fun Memory.loadDoubleAt(offset: Int): Double expect fun Memory.loadDoubleAt(offset: Long): Double
Read short signed 64bit floating point number in the network byte order (Big Endian) |
|
expect fun Memory.loadFloatArray(offset: Int, destination: FloatArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit expect fun Memory.loadFloatArray(offset: Long, destination: FloatArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit
Copies floating point numbers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian). |
|
expect fun Memory.loadFloatAt(offset: Int): Float expect fun Memory.loadFloatAt(offset: Long): Float
Read short signed 32bit floating point number in the network byte order (Big Endian) |
|
expect fun Memory.loadIntArray(offset: Int, destination: IntArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit expect fun Memory.loadIntArray(offset: Long, destination: IntArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit
Copies regular integers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian). |
|
expect fun Memory.loadIntAt(offset: Int): Int expect fun Memory.loadIntAt(offset: Long): Int
Read regular signed 32bit integer in the network byte order (Big Endian) |
|
expect fun Memory.loadLongArray(offset: Int, destination: LongArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit expect fun Memory.loadLongArray(offset: Long, destination: LongArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit
Copies long integers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian). |
|
expect fun Memory.loadLongAt(offset: Int): Long expect fun Memory.loadLongAt(offset: Long): Long
Read short signed 64bit integer in the network byte order (Big Endian) |
|
expect fun Memory.loadShortArray(offset: Int, destination: ShortArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit expect fun Memory.loadShortArray(offset: Long, destination: ShortArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit
Copies shorts integers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian). |
|
expect fun Memory.loadShortAt(offset: Int): Short expect fun Memory.loadShortAt(offset: Long): Short
Read short signed 16bit integer in the network byte order (Big Endian) |
|
fun Memory.loadUByteArray(offset: Int, destination: <ERROR CLASS>, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit fun Memory.loadUByteArray(offset: Long, destination: <ERROR CLASS>, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit
Copies unsigned shorts integers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian). |
|
fun Memory.loadUIntArray(offset: Int, destination: <ERROR CLASS>, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit fun Memory.loadUIntArray(offset: Long, destination: <ERROR CLASS>, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit
Copies unsigned integers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian). |
|
fun Memory.loadUIntAt(offset: Int): <ERROR CLASS> fun Memory.loadUIntAt(offset: Long): <ERROR CLASS>
Read regular unsigned 32bit integer in the network byte order (Big Endian) |
|
fun Memory.loadULongArray(offset: Int, destination: <ERROR CLASS>, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit fun Memory.loadULongArray(offset: Long, destination: <ERROR CLASS>, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit
Copies unsigned long integers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian). |
|
fun Memory.loadULongAt(offset: Int): <ERROR CLASS> fun Memory.loadULongAt(offset: Long): <ERROR CLASS>
Read short signed 64bit integer in the network byte order (Big Endian) |
|
fun Memory.loadUShortArray(offset: Int, destination: <ERROR CLASS>, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit fun Memory.loadUShortArray(offset: Long, destination: <ERROR CLASS>, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset): Unit
Copies unsigned shorts integers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian). |
|
fun Memory.loadUShortAt(offset: Int): <ERROR CLASS> fun Memory.loadUShortAt(offset: Long): <ERROR CLASS>
Read short unsigned 16bit integer in the network byte order (Big Endian) |
|
fun <ERROR CLASS>.reverseByteOrder(): <ERROR CLASS>
Reverse number's byte order |
|
operator fun Memory.set(index: Long, value: Byte): Unit operator fun Memory.set(index: Int, value: Byte): Unit
|
|
fun Memory.storeAt(index: Long, value: <ERROR CLASS>): Unit fun Memory.storeAt(index: Int, value: <ERROR CLASS>): Unit
|
|
fun Memory.storeByteArray(offset: Int, source: ByteArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit fun Memory.storeByteArray(offset: Long, source: ByteArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit
Copies unsigned shorts integers from the source array at sourceOffset to this memory at the specified offset. |
|
expect fun Memory.storeDoubleArray(offset: Int, source: DoubleArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit expect fun Memory.storeDoubleArray(offset: Long, source: DoubleArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit
Copies floating point numbers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian). |
|
expect fun Memory.storeDoubleAt(offset: Int, value: Double): Unit expect fun Memory.storeDoubleAt(offset: Long, value: Double): Unit
Write short signed 64bit floating point number in the network byte order (Big Endian) |
|
expect fun Memory.storeFloatArray(offset: Int, source: FloatArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit expect fun Memory.storeFloatArray(offset: Long, source: FloatArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit
Copies floating point numbers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian). |
|
expect fun Memory.storeFloatAt(offset: Int, value: Float): Unit expect fun Memory.storeFloatAt(offset: Long, value: Float): Unit
Write short signed 32bit floating point number in the network byte order (Big Endian) |
|
expect fun Memory.storeIntArray(offset: Int, source: IntArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit expect fun Memory.storeIntArray(offset: Long, source: IntArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit
Copies regular integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian). |
|
expect fun Memory.storeIntAt(offset: Int, value: Int): Unit expect fun Memory.storeIntAt(offset: Long, value: Int): Unit
Write regular signed 32bit integer in the network byte order (Big Endian) |
|
expect fun Memory.storeLongArray(offset: Int, source: LongArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit expect fun Memory.storeLongArray(offset: Long, source: LongArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit
Copies long integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian). |
|
expect fun Memory.storeLongAt(offset: Int, value: Long): Unit
Write short signed 64bit integer in the network byte order (Big Endian) expect fun Memory.storeLongAt(offset: Long, value: Long): Unit
write short signed 64bit integer in the network byte order (Big Endian) |
|
expect fun Memory.storeShortArray(offset: Int, source: ShortArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit expect fun Memory.storeShortArray(offset: Long, source: ShortArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit
Copies shorts integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian). |
|
expect fun Memory.storeShortAt(offset: Int, value: Short): Unit expect fun Memory.storeShortAt(offset: Long, value: Short): Unit
Write short signed 16bit integer in the network byte order (Big Endian) |
|
fun Memory.storeUByteArray(offset: Int, source: <ERROR CLASS>, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit fun Memory.storeUByteArray(offset: Long, source: <ERROR CLASS>, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit
Copies unsigned shorts integers from the source array at sourceOffset to this memory at the specified offset. |
|
fun Memory.storeUIntArray(offset: Int, source: <ERROR CLASS>, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit fun Memory.storeUIntArray(offset: Long, source: <ERROR CLASS>, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit
Copies unsigned integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian). |
|
fun Memory.storeUIntAt(offset: Int, value: <ERROR CLASS>): Unit fun Memory.storeUIntAt(offset: Long, value: <ERROR CLASS>): Unit
Write regular unsigned 32bit integer in the network byte order (Big Endian) |
|
fun Memory.storeULongArray(offset: Int, source: <ERROR CLASS>, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit fun Memory.storeULongArray(offset: Long, source: <ERROR CLASS>, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit
Copies unsigned long integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian). |
|
fun Memory.storeULongAt(offset: Int, value: <ERROR CLASS>): Unit fun Memory.storeULongAt(offset: Long, value: <ERROR CLASS>): Unit
Write short signed 64bit integer in the network byte order (Big Endian) |
|
fun Memory.storeUShortArray(offset: Int, source: <ERROR CLASS>, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit fun Memory.storeUShortArray(offset: Long, source: <ERROR CLASS>, sourceOffset: Int = 0, count: Int = source.size - sourceOffset): Unit
Copies unsigned shorts integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian). |
|
fun Memory.storeUShortAt(offset: Int, value: <ERROR CLASS>): Unit fun Memory.storeUShortAt(offset: Long, value: <ERROR CLASS>): Unit
Write short unsigned 16bit integer in the network byte order (Big Endian) |
|
fun <R> withMemory(size: Int, block: (Memory) -> R): R fun <R> withMemory(size: Long, block: (Memory) -> R): R
Invoke block function with a temporary Memory instance of the specified size in bytes. The provided instance shouldn't be captured and used outside of the block otherwise an undefined behaviour may occur including crash and/or data corruption. |
fun Memory.Companion.of(array: ByteArray, offset: Int = 0, length: Int = array.size - offset): Memory
Create Memory view for the specified array range starting at offset and the specified bytes length. fun Memory.Companion.of(buffer: ByteBuffer): Memory
Create Memory view for the specified buffer range starting at ByteBuffer.position and ending at ByteBuffer.limit. Changing the original buffer's position/limit will not affect previously created Memory instances. |