readAvailable

fun Buffer.readAvailable(destination: ByteArray, offset: Int = 0, length: Int = destination.size - offset): Int
fun Buffer.readAvailable(destination: UByteArray, offset: Int = 0, length: Int = destination.size - offset): Int

Read available for read bytes to the destination array range starting at array offset and length bytes. If less than length bytes available then less bytes will be copied and the corresponding number will be returned as result.

Return

number of bytes copied to the destination or -1 if the buffer is empty


inline fun ChunkBuffer.readAvailable(destination: ByteArray, offset: Int = 0, length: Int = destination.size - offset): Int
fun Input.readAvailable(dst: ByteArray, offset: Int = 0, length: Int = dst.size - offset): Int
fun Input.readAvailable(dst: ShortArray, offset: Int = 0, length: Int = dst.size - offset): Int
fun Input.readAvailable(dst: IntArray, offset: Int = 0, length: Int = dst.size - offset): Int
fun Input.readAvailable(dst: LongArray, offset: Int = 0, length: Int = dst.size - offset): Int
fun Input.readAvailable(dst: FloatArray, offset: Int = 0, length: Int = dst.size - offset): Int
fun Input.readAvailable(dst: DoubleArray, offset: Int = 0, length: Int = dst.size - offset): Int
fun Input.readAvailable(dst: Buffer, length: Int = dst.writeRemaining): Int
fun Input.readAvailable(destination: Memory, destinationOffset: Int, length: Int): Int
fun Input.readAvailable(destination: Memory, destinationOffset: Long, length: Long): Long


fun Buffer.readAvailable(destination: ShortArray, offset: Int = 0, length: Int = destination.size - offset): Int
fun Buffer.readAvailable(destination: UShortArray, offset: Int = 0, length: Int = destination.size - offset): Int
fun Buffer.readAvailable(destination: IntArray, offset: Int = 0, length: Int = destination.size - offset): Int
fun Buffer.readAvailable(destination: UIntArray, offset: Int = 0, length: Int = destination.size - offset): Int
fun Buffer.readAvailable(destination: LongArray, offset: Int = 0, length: Int = destination.size - offset): Int
fun Buffer.readAvailable(destination: ULongArray, offset: Int = 0, length: Int = destination.size - offset): Int
fun Buffer.readAvailable(destination: FloatArray, offset: Int = 0, length: Int = destination.size - offset): Int
fun Buffer.readAvailable(destination: DoubleArray, offset: Int = 0, length: Int = destination.size - offset): Int

Read available for read bytes to the destination array range starting at array offset and length elements. If less than length elements available then less elements will be copied and the corresponding number will be returned as result (possibly zero).

Return

number of elements copied to the destination or -1 if the buffer is empty, 0 - not enough bytes for at least an element


fun Buffer.readAvailable(dst: Buffer, length: Int = dst.writeRemaining): Int

Read at most length available bytes to the dst buffer or -1 if no bytes available for read.

Return

number of bytes copied or -1 if empty

fun Buffer.readAvailable(dst: ArrayBuffer, offset: Int = 0, length: Int = dst.byteLength - offset): Int
fun Buffer.readAvailable(dst: ArrayBufferView, offset: Int = 0, length: Int = dst.byteLength - offset): Int
fun Input.readAvailable(dst: Int8Array, offset: Int = 0, length: Int = dst.length - offset): Int
fun Input.readAvailable(dst: ArrayBuffer, offset: Int = 0, length: Int = dst.byteLength - offset): Int
fun Input.readAvailable(dst: ArrayBufferView, byteOffset: Int = 0, byteLength: Int = dst.byteLength - byteOffset): Int
fun Buffer.readAvailable(dst: ByteBuffer, length: Int = dst.remaining()): Int
fun Input.readAvailable(dst: ByteBuffer, length: Int = dst.remaining()): Int


fun ByteReadPacket.readAvailable(dst: ByteBuffer): Int

Read at most dst.remaining() bytes to the specified dst byte buffer and change its position accordingly

Return

number of bytes copied

fun Buffer.readAvailable(pointer: <ERROR CLASS><<ERROR CLASS>>, offset: Int, length: Int): Int
fun Buffer.readAvailable(pointer: <ERROR CLASS><<ERROR CLASS>>, offset: Long, length: Int): Int
fun Input.readAvailable(dst: <ERROR CLASS><<ERROR CLASS>>, offset: Int, length: Int): Int
fun Input.readAvailable(dst: <ERROR CLASS><<ERROR CLASS>>, offset: Long, length: Long): Long


fun ByteReadPacket.readAvailable(dst: <ERROR CLASS><<ERROR CLASS>>, limit: Int): Int
fun ByteReadPacket.readAvailable(dst: <ERROR CLASS><<ERROR CLASS>>, limit: Long): Long

Read at most limit bytes to the specified dst address

Return

number of bytes copied