sok / Sok.Buffer / JVMMultiplatformBuffer
class JVMMultiplatformBuffer
(source)
Platform and version requirements: JVM
JVM implementation of the MultiplatformBuffer
class
<init> | JVMMultiplatformBuffer(size: Int ) Allocate a new MultiplatformBuffer JVMMultiplatformBuffer(array: ByteArray ) Create a new MultiplatformBuffer wrapping a byteArray , thus avoiding copy JVMMultiplatformBuffer(array: ByteBuffer ) Create a MultiplatformBuffer with a specific NIO ByteBuffer |
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(): Unit Destroy 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 ?): Byte Get 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 ?): ByteArray Get 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 ): Unit Copy 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 ?): Int Get 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 ?): Long Get 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 ?): Short Get 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 ?): Unit Put 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 ?): Unit Put 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 ?): Unit Put 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 ?): Unit Put 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 ?): Unit Put 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 ): Unit Used only by the JVM to synchronize the MultiplatformBuffer state with the ByteBuffer state |
setLimitImpl | fun setLimitImpl(index: Int ): Unit Used only by the JVM to synchronize the MultiplatformBuffer state with the ByteBuffer state |
toArray | fun toArray(): ByteArray Get 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 |