SokDoc

sok / Sok.Buffer / JVMMultiplatformBuffer / getBytesImpl

getBytesImpl

fun getBytesImpl(length: Int, index: Int?): ByteArray (source)

Platform and version requirements: JVM

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

Parameters

length - amount of data to get

index - index of the first byte, buffer.cursor is used if the index is null

Return data copied from the buffer

fun getBytesImpl(array: ByteArray, index: Int?, destinationOffset: Int, length: Int): Unit (source)

Platform and version requirements: JVM

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.

Parameters

array - destination array

index - index of the first byte, buffer.cursor is used if the index is null

destinationOffset - The offset within the array of the first byte to be written

length - amount of data to copy