Package io.ktor.utils.io.bits

Types

Link copied to clipboard
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.

actual inline class Memory
actual class Memory

Functions

Link copied to clipboard
fun <ERROR CLASS>.allocMemory(size: Int): Memory
fun <ERROR CLASS>.allocMemory(size: Long): Memory

Allocate memory range having the specified size in bytes and provide an instance of Memory view for this range. Please note that depending of the placement type (e.g. scoped or global) this memory instance may require explicit release using free on the same placement. In particular, instances created inside of memScoped block do not require to be released explicitly but once the scope is leaved, all produced instances should be discarded and should be never used after the scope. On the contrary instances created using nativeHeap do require release via nativeHeap.free.

Link copied to clipboard
fun Memory.copyTo(destination: ByteArray, offset: Int, length: Int)
fun Memory.copyTo(destination: ByteArray, offset: Long, length: Int)

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)
expect fun Memory.copyTo(destination: ByteArray, offset: Long, length: Int, destinationOffset: Int)

Copies bytes from this memory range from the specified offset and length to the destination at destinationOffset.

fun Memory.copyTo(destination: ByteBuffer, offset: Int)
fun Memory.copyTo(destination: ByteBuffer, offset: Long)

Copies bytes from this memory range from the specified offset to the destination buffer.

fun ByteBuffer.copyTo(destination: Memory, offset: Int)

Copy byte from this buffer moving it's position to the destination at offset.

actual fun Memory.copyTo(destination: ByteArray, offset: Int, length: Int, destinationOffset: Int)
actual fun Memory.copyTo(destination: ByteArray, offset: Long, length: Int, destinationOffset: Int)

Copies bytes from this memory range from the specified offset and length to the destination at destinationOffset.

fun <ERROR CLASS><<ERROR CLASS>>.copyTo(destination: Memory, offset: Int, length: Int, destinationOffset: Int)
fun <ERROR CLASS><<ERROR CLASS>>.copyTo(destination: Memory, offset: Long, length: Long, destinationOffset: Long)

Copy length bytes to the destination at the specified destinationOffset from the memory addressed by this pointer with offset in bytes.

fun Memory.copyTo(destination: <ERROR CLASS><<ERROR CLASS>>, offset: Int, length: Int, destinationOffset: Int)
fun Memory.copyTo(destination: <ERROR CLASS><<ERROR CLASS>>, offset: Long, length: Long, destinationOffset: Long)

Copy content bytes to the memory addressed by the destination pointer with the specified destinationOffset in bytes.

actual fun Memory.copyTo(destination: ByteArray, offset: Int, length: Int, destinationOffset: Int)
actual fun Memory.copyTo(destination: ByteArray, offset: Long, length: Int, destinationOffset: Int)

Copies bytes from this memory range from the specified offset and length to the destination at destinationOffset.

Link copied to clipboard
expect fun Memory.fill(offset: Int, count: Int, value: Byte)
expect fun Memory.fill(offset: Long, count: Long, value: Byte)

Fill memory range starting at the specified offset with value repeated count times.

actual fun Memory.fill(offset: Int, count: Int, value: Byte)
actual fun Memory.fill(offset: Long, count: Long, value: Byte)

Fill memory range starting at the specified offset with value repeated count times.

actual fun Memory.fill(offset: Int, count: Int, value: Byte)
actual fun Memory.fill(offset: Long, count: Long, value: Byte)

Fill memory range starting at the specified offset with value repeated count times.

Link copied to clipboard
fun <ERROR CLASS>.free(memory: Memory)

Release resources that the memory instance is holding. This function should be only used for memory instances that are produced by allocMemory function otherwise an undefined behaviour may occur including crash or data corruption.

Link copied to clipboard
inline operator fun Memory.get(index: Int): Byte
inline operator fun Memory.get(index: Long): Byte

Read byte at the specified index.

Link copied to clipboard
inline fun Memory.loadByteArray(offset: Int, destination: ByteArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

Copies bytes from this memory range from the specified offset and count to the destination at destinationOffset.

inline fun Memory.loadByteArray(offset: Long, destination: ByteArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

Link copied to clipboard
expect fun Memory.loadDoubleArray(offset: Int, destination: DoubleArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
expect fun Memory.loadDoubleArray(offset: Long, destination: DoubleArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

actual fun Memory.loadDoubleArray(offset: Int, destination: DoubleArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
actual fun Memory.loadDoubleArray(offset: Long, destination: DoubleArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

actual fun Memory.loadDoubleArray(offset: Int, destination: DoubleArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
actual fun Memory.loadDoubleArray(offset: Long, destination: DoubleArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

Link copied to clipboard
expect inline fun Memory.loadDoubleAt(offset: Int): Double
expect inline fun Memory.loadDoubleAt(offset: Long): Double

Read short signed 64bit floating point number in the network byte order (Big Endian)

actual inline fun Memory.loadDoubleAt(offset: Int): Double
actual inline fun Memory.loadDoubleAt(offset: Long): Double
actual inline fun Memory.loadDoubleAt(offset: Int): Double
actual inline fun Memory.loadDoubleAt(offset: Long): Double
Link copied to clipboard
expect fun Memory.loadFloatArray(offset: Int, destination: FloatArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
expect fun Memory.loadFloatArray(offset: Long, destination: FloatArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

actual fun Memory.loadFloatArray(offset: Int, destination: FloatArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
actual fun Memory.loadFloatArray(offset: Long, destination: FloatArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

actual fun Memory.loadFloatArray(offset: Int, destination: FloatArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
actual fun Memory.loadFloatArray(offset: Long, destination: FloatArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

Link copied to clipboard
expect inline fun Memory.loadFloatAt(offset: Int): Float
expect inline fun Memory.loadFloatAt(offset: Long): Float

Read short signed 32bit floating point number in the network byte order (Big Endian)

actual inline fun Memory.loadFloatAt(offset: Int): Float
actual inline fun Memory.loadFloatAt(offset: Long): Float
actual inline fun Memory.loadFloatAt(offset: Int): Float
actual inline fun Memory.loadFloatAt(offset: Long): Float
Link copied to clipboard
expect fun Memory.loadIntArray(offset: Int, destination: IntArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
expect fun Memory.loadIntArray(offset: Long, destination: IntArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

actual fun Memory.loadIntArray(offset: Int, destination: IntArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
actual fun Memory.loadIntArray(offset: Long, destination: IntArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

actual fun Memory.loadIntArray(offset: Int, destination: IntArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
actual fun Memory.loadIntArray(offset: Long, destination: IntArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

Link copied to clipboard
expect inline fun Memory.loadIntAt(offset: Int): Int
expect inline fun Memory.loadIntAt(offset: Long): Int

Read regular signed 32bit integer in the network byte order (Big Endian)

actual inline fun Memory.loadIntAt(offset: Int): Int
actual inline fun Memory.loadIntAt(offset: Long): Int
actual inline fun Memory.loadIntAt(offset: Int): Int
actual inline fun Memory.loadIntAt(offset: Long): Int
Link copied to clipboard
expect fun Memory.loadLongArray(offset: Int, destination: LongArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
expect fun Memory.loadLongArray(offset: Long, destination: LongArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

actual fun Memory.loadLongArray(offset: Int, destination: LongArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
actual fun Memory.loadLongArray(offset: Long, destination: LongArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

actual fun Memory.loadLongArray(offset: Int, destination: LongArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
actual fun Memory.loadLongArray(offset: Long, destination: LongArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

Link copied to clipboard
expect inline fun Memory.loadLongAt(offset: Int): Long
expect inline fun Memory.loadLongAt(offset: Long): Long

Read short signed 64bit integer in the network byte order (Big Endian)

actual inline fun Memory.loadLongAt(offset: Int): Long
actual inline fun Memory.loadLongAt(offset: Long): Long
actual inline fun Memory.loadLongAt(offset: Int): Long
actual inline fun Memory.loadLongAt(offset: Long): Long
Link copied to clipboard
expect fun Memory.loadShortArray(offset: Int, destination: ShortArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
expect fun Memory.loadShortArray(offset: Long, destination: ShortArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

Copies short integers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian).

actual fun Memory.loadShortArray(offset: Int, destination: ShortArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
actual fun Memory.loadShortArray(offset: Long, destination: ShortArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

Copies short integers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian).

actual fun Memory.loadShortArray(offset: Int, destination: ShortArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
actual fun Memory.loadShortArray(offset: Long, destination: ShortArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

Copies short integers from this memory range from the specified offset and count to the destination at destinationOffset interpreting numbers in the network order (Big Endian).

Link copied to clipboard
expect inline fun Memory.loadShortAt(offset: Int): Short
expect inline fun Memory.loadShortAt(offset: Long): Short

Read short signed 16bit integer in the network byte order (Big Endian)

actual inline fun Memory.loadShortAt(offset: Int): Short
actual inline fun Memory.loadShortAt(offset: Long): Short
actual inline fun Memory.loadShortAt(offset: Int): Short
actual inline fun Memory.loadShortAt(offset: Long): Short
Link copied to clipboard
inline fun Memory.loadUByteArray(offset: Int, destination: UByteArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
inline fun Memory.loadUByteArray(offset: Long, destination: UByteArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

Link copied to clipboard
inline fun Memory.loadUIntArray(offset: Int, destination: UIntArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
inline fun Memory.loadUIntArray(offset: Long, destination: UIntArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

Link copied to clipboard
inline fun Memory.loadUIntAt(offset: Int): UInt
inline fun Memory.loadUIntAt(offset: Long): UInt

Read regular unsigned 32bit integer in the network byte order (Big Endian)

Link copied to clipboard
inline fun Memory.loadULongArray(offset: Int, destination: ULongArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
inline fun Memory.loadULongArray(offset: Long, destination: ULongArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

Link copied to clipboard
inline fun Memory.loadULongAt(offset: Int): ULong
inline fun Memory.loadULongAt(offset: Long): ULong

Read short signed 64bit integer in the network byte order (Big Endian)

Link copied to clipboard
inline fun Memory.loadUShortArray(offset: Int, destination: UShortArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)
inline fun Memory.loadUShortArray(offset: Long, destination: UShortArray, destinationOffset: Int = 0, count: Int = destination.size - destinationOffset)

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).

Link copied to clipboard
inline fun Memory.loadUShortAt(offset: Int): UShort
inline fun Memory.loadUShortAt(offset: Long): UShort

Read short unsigned 16bit integer in the network byte order (Big Endian)

Link copied to clipboard
inline 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.

inline 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.

inline fun Memory.Companion.of(pointer: <ERROR CLASS><out <ERROR CLASS>>, size: Int): Memory
inline fun Memory.Companion.of(pointer: <ERROR CLASS><out <ERROR CLASS>>, size: Long): Memory
inline fun Memory.Companion.of(pointer: <ERROR CLASS><out <ERROR CLASS>>, size: <ERROR CLASS>): Memory

Create an instance of Memory view for memory region starting at the specified pointer and having the specified size in bytes.

Link copied to clipboard
expect fun Double.reverseByteOrder(): Double
expect fun Float.reverseByteOrder(): Float
expect fun Int.reverseByteOrder(): Int
expect fun Long.reverseByteOrder(): Long
expect fun Short.reverseByteOrder(): Short
fun UInt.reverseByteOrder(): UInt
fun ULong.reverseByteOrder(): ULong
fun UShort.reverseByteOrder(): UShort

Reverse number's byte order

actual inline fun Double.reverseByteOrder(): Double
actual inline fun Float.reverseByteOrder(): Float
actual inline fun Int.reverseByteOrder(): Int
actual inline fun Long.reverseByteOrder(): Long
actual inline fun Short.reverseByteOrder(): Short

Reverse number's byte order

actual fun Double.reverseByteOrder(): Double
actual fun Float.reverseByteOrder(): Float
actual fun Int.reverseByteOrder(): Int
actual fun Long.reverseByteOrder(): Long
actual fun Short.reverseByteOrder(): Short

Reverse number's byte order

Link copied to clipboard
inline operator fun Memory.set(index: Int, value: Byte)
inline operator fun Memory.set(index: Long, value: Byte)

Index write operator to write value at the specified index

Link copied to clipboard
inline fun Memory.storeAt(index: Int, value: UByte)
inline fun Memory.storeAt(index: Long, value: UByte)

Index write operator to write value at the specified index

Link copied to clipboard
inline fun Memory.storeByteArray(offset: Int, source: ByteArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
inline fun Memory.storeByteArray(offset: Long, source: ByteArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies unsigned shorts integers from the source array at sourceOffset to this memory at the specified offset.

Link copied to clipboard
expect fun Memory.storeDoubleArray(offset: Int, source: DoubleArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
expect fun Memory.storeDoubleArray(offset: Long, source: DoubleArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

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).

actual fun Memory.storeDoubleArray(offset: Int, source: DoubleArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
actual fun Memory.storeDoubleArray(offset: Long, source: DoubleArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

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).

actual fun Memory.storeDoubleArray(offset: Int, source: DoubleArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
actual fun Memory.storeDoubleArray(offset: Long, source: DoubleArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

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).

Link copied to clipboard
expect inline fun Memory.storeDoubleAt(offset: Int, value: Double)
expect inline fun Memory.storeDoubleAt(offset: Long, value: Double)

Write short signed 64bit floating point number in the network byte order (Big Endian)

actual inline fun Memory.storeDoubleAt(offset: Int, value: Double)
actual inline fun Memory.storeDoubleAt(offset: Long, value: Double)

Write short signed 64bit floating point number in the network byte order (Big Endian)

actual inline fun Memory.storeDoubleAt(offset: Int, value: Double)
actual inline fun Memory.storeDoubleAt(offset: Long, value: Double)

Write short signed 64bit floating point number in the network byte order (Big Endian)

Link copied to clipboard
expect fun Memory.storeFloatArray(offset: Int, source: FloatArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
expect fun Memory.storeFloatArray(offset: Long, source: FloatArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

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).

actual fun Memory.storeFloatArray(offset: Int, source: FloatArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
actual fun Memory.storeFloatArray(offset: Long, source: FloatArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

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).

actual fun Memory.storeFloatArray(offset: Int, source: FloatArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
actual fun Memory.storeFloatArray(offset: Long, source: FloatArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

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).

Link copied to clipboard
expect inline fun Memory.storeFloatAt(offset: Int, value: Float)
expect inline fun Memory.storeFloatAt(offset: Long, value: Float)

Write short signed 32bit floating point number in the network byte order (Big Endian)

actual inline fun Memory.storeFloatAt(offset: Int, value: Float)
actual inline fun Memory.storeFloatAt(offset: Long, value: Float)

Write short signed 32bit floating point number in the network byte order (Big Endian)

actual inline fun Memory.storeFloatAt(offset: Int, value: Float)
actual inline fun Memory.storeFloatAt(offset: Long, value: Float)

Write short signed 32bit floating point number in the network byte order (Big Endian)

Link copied to clipboard
expect fun Memory.storeIntArray(offset: Int, source: IntArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
expect fun Memory.storeIntArray(offset: Long, source: IntArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies regular integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian).

actual fun Memory.storeIntArray(offset: Int, source: IntArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
actual fun Memory.storeIntArray(offset: Long, source: IntArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies regular integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian).

actual fun Memory.storeIntArray(offset: Int, source: IntArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
actual fun Memory.storeIntArray(offset: Long, source: IntArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies regular integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian).

Link copied to clipboard
expect inline fun Memory.storeIntAt(offset: Int, value: Int)
expect inline fun Memory.storeIntAt(offset: Long, value: Int)

Write regular signed 32bit integer in the network byte order (Big Endian)

actual inline fun Memory.storeIntAt(offset: Int, value: Int)
actual inline fun Memory.storeIntAt(offset: Long, value: Int)

Write regular signed 32bit integer in the network byte order (Big Endian)

actual inline fun Memory.storeIntAt(offset: Int, value: Int)
actual inline fun Memory.storeIntAt(offset: Long, value: Int)

Write regular signed 32bit integer in the network byte order (Big Endian)

Link copied to clipboard
expect fun Memory.storeLongArray(offset: Int, source: LongArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
expect fun Memory.storeLongArray(offset: Long, source: LongArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies long integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian).

actual fun Memory.storeLongArray(offset: Int, source: LongArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
actual fun Memory.storeLongArray(offset: Long, source: LongArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies regular integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian).

actual fun Memory.storeLongArray(offset: Int, source: LongArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
actual fun Memory.storeLongArray(offset: Long, source: LongArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies regular integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian).

Link copied to clipboard
expect inline fun Memory.storeLongAt(offset: Int, value: Long)

Write short signed 64bit integer in the network byte order (Big Endian)

expect inline fun Memory.storeLongAt(offset: Long, value: Long)

write short signed 64bit integer in the network byte order (Big Endian)

actual inline fun Memory.storeLongAt(offset: Int, value: Long)
actual inline fun Memory.storeLongAt(offset: Long, value: Long)

Write short signed 64bit integer in the network byte order (Big Endian)

actual inline fun Memory.storeLongAt(offset: Int, value: Long)
actual inline fun Memory.storeLongAt(offset: Long, value: Long)

Write short signed 64bit integer in the network byte order (Big Endian)

Link copied to clipboard
expect fun Memory.storeShortArray(offset: Int, source: ShortArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
expect fun Memory.storeShortArray(offset: Long, source: ShortArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies short integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian).

actual fun Memory.storeShortArray(offset: Int, source: ShortArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
actual fun Memory.storeShortArray(offset: Long, source: ShortArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies short integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian).

actual fun Memory.storeShortArray(offset: Int, source: ShortArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
actual fun Memory.storeShortArray(offset: Long, source: ShortArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies short integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian).

Link copied to clipboard
expect inline fun Memory.storeShortAt(offset: Int, value: Short)
expect inline fun Memory.storeShortAt(offset: Long, value: Short)

Write short signed 16bit integer in the network byte order (Big Endian)

actual inline fun Memory.storeShortAt(offset: Int, value: Short)
actual inline fun Memory.storeShortAt(offset: Long, value: Short)

Write short signed 16bit integer in the network byte order (Big Endian)

actual inline fun Memory.storeShortAt(offset: Int, value: Short)
actual inline fun Memory.storeShortAt(offset: Long, value: Short)

Write short signed 16bit integer in the network byte order (Big Endian)

Link copied to clipboard
inline fun Memory.storeUByteArray(offset: Int, source: UByteArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
inline fun Memory.storeUByteArray(offset: Long, source: UByteArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies unsigned shorts integers from the source array at sourceOffset to this memory at the specified offset.

Link copied to clipboard
inline fun Memory.storeUIntArray(offset: Int, source: UIntArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
inline fun Memory.storeUIntArray(offset: Long, source: UIntArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

Copies unsigned integers from the source array at sourceOffset to this memory at the specified offset interpreting numbers in the network order (Big Endian).

Link copied to clipboard
inline fun Memory.storeUIntAt(offset: Int, value: UInt)
inline fun Memory.storeUIntAt(offset: Long, value: UInt)

Write regular unsigned 32bit integer in the network byte order (Big Endian)

Link copied to clipboard
inline fun Memory.storeULongArray(offset: Int, source: ULongArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
inline fun Memory.storeULongArray(offset: Long, source: ULongArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

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).

Link copied to clipboard
inline fun Memory.storeULongAt(offset: Int, value: ULong)
inline fun Memory.storeULongAt(offset: Long, value: ULong)

Write short signed 64bit integer in the network byte order (Big Endian)

Link copied to clipboard
inline fun Memory.storeUShortArray(offset: Int, source: UShortArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)
inline fun Memory.storeUShortArray(offset: Long, source: UShortArray, sourceOffset: Int = 0, count: Int = source.size - sourceOffset)

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).

Link copied to clipboard
inline fun Memory.storeUShortAt(offset: Int, value: UShort)
inline fun Memory.storeUShortAt(offset: Long, value: UShort)

Write short unsigned 16bit integer in the network byte order (Big Endian)

Link copied to clipboard
expect fun <R> ByteArray.useMemory(offset: Int = 0, length: Int, block: (Memory) -> R): R

TODO KTOR-1673: Solve design problems

actual inline fun <R> ByteArray.useMemory(offset: Int = 0, length: Int, block: (Memory) -> R): R

Execute block of code providing a temporary instance of Memory view of this byte array range starting at the specified offset and having the specified bytes length. By default, if neither offset nor length specified, the whole array is used. An instance of Memory provided into the block should be never captured and used outside of lambda.

actual inline fun <R> ByteArray.useMemory(offset: Int = 0, length: Int, block: (Memory) -> R): R

Execute block of code providing a temporary instance of Memory view of this byte array range starting at the specified offset and having the specified bytes length. By default, if neither offset nor length specified, the whole array is used. An instance of Memory provided into the block should be never captured and used outside of lambda.

Link copied to clipboard
inline fun <R> withMemory(size: Int, block: (Memory) -> R): R
inline 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.

Properties

Link copied to clipboard
val Short.highByte: Byte
Link copied to clipboard
val Long.highInt: Int
Link copied to clipboard
val Int.highShort: Short
Link copied to clipboard
val Short.lowByte: Byte
Link copied to clipboard
val Long.lowInt: Int
Link copied to clipboard
val Int.lowShort: Short