sok / Sok.Buffer / NativeMultiplatformBuffer
class NativeMultiplatformBuffer (source)
Platform and version requirements: Native
Native implementation of the MultiplatformBuffer class
| <init> | NativeMultiplatformBuffer(size: Int)Allocate a new MultiplatformBuffer NativeMultiplatformBuffer(array: ByteArray)Create a new MultiplatformBuffer wrapping a byteArray , thus avoiding copy |
| clone | fun clone(): <ERROR CLASS>Deep copy the buffer. All the data from the start to the capacity will be copied, the cursor and limit will be reset |
| destroy | fun destroy(): UnitDestroy the ByteBuffer, you cannot call any method on the buffer after calling destroy. This method MUST be called on native platforms in order to free/unpin memory but you can skip it on any other platform |
| getByteImpl | fun getByteImpl(index: Int?): ByteGet the byte at the current cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| getBytesImpl | fun getBytesImpl(length: Int, index: Int?): ByteArrayGet an array of bytes of a given length starting at the current buffer cursor position. If the index parameter is provided, the cursor will be ignored and not modified fun getBytesImpl(array: ByteArray, index: Int?, destinationOffset: Int, length: Int): UnitCopy bytes into the array starting from the current cursor position or given index. You can start the copy with an offset in the destination array and specify the number of byte you want to be copied. |
| getIntImpl | fun getIntImpl(index: Int?): IntGet the integer at the current cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| getLongImpl | fun getLongImpl(index: Int?): LongGet the long at the current cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| getShortImpl | fun getShortImpl(index: Int?): ShortGet the short at the current cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| getUByteImpl | fun getUByteImpl(index: Int?): <ERROR CLASS>Get the unsigned byte at the current cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| getUIntImpl | fun getUIntImpl(index: Int?): <ERROR CLASS>Get the unsigned integer at the current cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| getULongImpl | fun getULongImpl(index: Int?): <ERROR CLASS>Get the unsigned long at the current cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| getUShortImpl | fun getUShortImpl(index: Int?): <ERROR CLASS>Get the unsigned short at the current cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| putByteImpl | fun putByteImpl(value: Byte, index: Int?): UnitPut the given byte inside the buffer at the buffer cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| putBytesImpl | fun putBytesImpl(array: ByteArray, index: Int?): UnitPut the given byte array inside the buffer starting at the buffer cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| putIntImpl | fun putIntImpl(value: Int, index: Int?): UnitPut the given integer inside the buffer starting at the buffer cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| putLongImpl | fun putLongImpl(value: Long, index: Int?): UnitPut the given long inside the buffer starting at the buffer cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| putShortImpl | fun putShortImpl(value: Short, index: Int?): UnitPut the given short inside the buffer starting at the buffer cursor position. If the index parameter is provided, the cursor will be ignored and not modified |
| setCursorImpl | fun setCursorImpl(index: Int): UnitUsed only by the JVM to synchronize the MultiplatformBuffer state with the ByteBuffer state |
| setLimitImpl | fun setLimitImpl(index: Int): UnitUsed only by the JVM to synchronize the MultiplatformBuffer state with the ByteBuffer state |
| toArray | fun toArray(): ByteArrayGet all the data between the start of the buffer and its limit, the data is copied and is not linked to the content of the buffer. WARNING this behaviour is different from the ByteBuffer array() method, please read the documentation carefully |