IoBuffer

expect class IoBuffer : ChunkBuffer, Input, Output

A read-write facade to actual buffer of fixed size. Multiple views could share the same actual buffer. Concurrent unsafe. The only concurrent-safe operation is release. In most cases ByteReadPacket and BytePacketBuilder should be used instead.

actual class IoBuffer : ChunkBuffer, Input, Output

A read-write facade to actual buffer of fixed size. Multiple views could share the same actual buffer.

actual class IoBuffer : ChunkBuffer, Input, Output

Constructors

Link copied to clipboard
fun IoBuffer(external: ByteBuffer)
Link copied to clipboard
fun IoBuffer(content: <ERROR CLASS><<ERROR CLASS>>, contentCapacity: Int)
Link copied to clipboard
expect fun IoBuffer(memory: Memory, origin: ChunkBuffer?)
actual fun IoBuffer(memory: Memory, origin: ChunkBuffer?)
actual fun IoBuffer(memory: Memory, origin: ChunkBuffer?)

Types

Link copied to clipboard
expect object Companion
actual object Companion
actual object Companion

Functions

Link copied to clipboard
expect abstract fun append(value: Char): Appendable
expect abstract fun append(value: CharSequence?): Appendable
expect abstract fun append(csq: CharArray, start: Int, end: Int): Appendable
expect abstract fun append(value: CharSequence?, startIndex: Int, endIndex: Int): Appendable
open override fun append(c: Char): Appendable
override fun append(csq: CharSequence?): Appendable
override fun append(csq: CharArray, start: Int, end: Int): Appendable
override fun append(csq: CharSequence?, start: Int, end: Int): Appendable
open fun append(c: Char): <ERROR CLASS>
fun append(csq: CharSequence?): <ERROR CLASS>
override fun append(csq: CharArray, start: Int, end: Int): <ERROR CLASS>
fun append(csq: CharSequence?, start: Int, end: Int): <ERROR CLASS>
Link copied to clipboard
fun appendChars(csq: CharArray, start: Int, end: Int): Int
fun appendChars(csq: CharSequence, start: Int, end: Int): Int
fun appendChars(csq: CharArray, start: Int, end: Int): Int
fun appendChars(csq: CharSequence, start: Int, end: Int): Int
Link copied to clipboard
fun canRead(): Boolean
Link copied to clipboard
fun canWrite(): Boolean
Link copied to clipboard
fun cleanNext(): ChunkBuffer?
fun cleanNext(): ChunkBuffer?
fun cleanNext(): ChunkBuffer?
Link copied to clipboard
expect open override fun close()

Close input including the underlying source. All pending bytes will be discarded. It is not recommended to invoke it with read operations in-progress concurrently.

actual open override fun close()
actual open override fun close()
Link copied to clipboard
fun commitWritten(count: Int)
fun commitWritten(count: Int)
fun commitWritten(count: Int)
Link copied to clipboard
fun discard(count: Int): Int

expect abstract fun discard(n: Long): Long

Discard at most n bytes

fun discard(count: Int): Int
actual abstract fun discard(n: Long): Long
fun discard(count: Int): Int
actual abstract fun discard(n: Long): Long
Link copied to clipboard
fun discardExact(count: Int = readRemaining)

Discard count readable bytes.

fun discardExact(count: Int = readRemaining)

Discard count readable bytes.

fun discardExact(count: Int = readRemaining)

Discard count readable bytes.

Link copied to clipboard
open override fun duplicate(): ChunkBuffer

Create a new Buffer instance pointing to the same memory and having the same positions.

open override fun duplicate(): IoBuffer

Create a new Buffer instance pointing to the same memory and having the same positions.

open override fun duplicate(): IoBuffer

Create a new Buffer instance pointing to the same memory and having the same positions.

Link copied to clipboard
expect open fun fill(n: Long, v: Byte)
override fun fill(n: Long, v: Byte)
override fun fill(n: Long, v: Byte)
Link copied to clipboard
expect override fun flush()
actual override fun flush()
actual override fun flush()
Link copied to clipboard
fun getNext(): IoBuffer?
Link copied to clipboard
fun isExclusivelyOwned(): Boolean
Link copied to clipboard
fun makeView(): IoBuffer

Creates a new view to the same actual buffer with independent read and write positions and gaps

fun makeView(): IoBuffer
Link copied to clipboard
expect open fun peekTo(buffer: IoBuffer): Int

Copy available bytes to the specified buffer but keep them available. The underlying implementation could trigger bytes population from the underlying source and block until any bytes available.

expect abstract fun peekTo(destination: Memory, destinationOffset: Long, offset: Long = 0, min: Long = 1, max: Long = Long.MAX_VALUE): Long

Try to copy at least min but up to max bytes to the specified destination buffer from this input skipping offset bytes. If there are not enough bytes available to provide min bytes after skipping offset bytes then it will trigger the underlying source reading first and after that will simply copy available bytes even if EOF encountered so min is not a requirement but a desired number of bytes. It is safe to specify max greater than the destination free space. min shouldn't be bigger than the destination free space. This function could trigger the underlying source reading that may lead to blocking I/O. It is allowed to specify too big offset so in this case this function will always return 0 after prefetching all underlying bytes but note that it may lead to significant memory consumption. This function usually copy more bytes than min (unless max = min) but it is not guaranteed. When 0 is returned with offset = 0 then it makes sense to check endOfInput.

override fun peekTo(buffer: IoBuffer): Int

Copy available bytes to the specified buffer but keep them available. If the underlying implementation could trigger bytes population from the underlying source and block until any bytes available

override fun peekTo(destination: Memory, destinationOffset: Long, offset: Long, min: Long, max: Long): Long

Copy at least min but up to max bytes to the specified destination buffer from this input skipping offset bytes. If there are not enough bytes available to provide min bytes then it fails with an exception. It is safe to specify max > destination.writeRemaining but min shouldn't be bigger than the destination free space. This function could trigger the underlying source reading that may lead to blocking I/O. It is safe to specify too big offset but only if min = 0, fails otherwise. This function usually copy more bytes than min (unless max = min).

override fun peekTo(buffer: IoBuffer): Int

Copy available bytes to the specified buffer but keep them available. If the underlying implementation could trigger bytes population from the underlying source and block until any bytes available

override fun peekTo(destination: Memory, destinationOffset: Long, offset: Long, min: Long, max: Long): Long

Copy at least min but up to max bytes to the specified destination buffer from this input skipping offset bytes. If there are not enough bytes available to provide min bytes then it fails with an exception. It is safe to specify max > destination.writeRemaining but min shouldn't be bigger than the destination free space. This function could trigger the underlying source reading that may lead to blocking I/O. It is safe to specify too big offset but only if min = 0, fails otherwise. This function usually copy more bytes than min (unless max = min).

Link copied to clipboard
fun pushBack(n: Int)

Push back n bytes: only possible if there were at least n bytes read before this operation.

Link copied to clipboard
fun read(dst: ByteBuffer, size: Int)
fun read(dst: ByteArray, offset: Int, length: Int)
Link copied to clipboard
expect open fun readAvailable(dst: IoBuffer, length: Int): Int
expect open fun readAvailable(dst: ByteArray, offset: Int, length: Int): Int
expect open fun readAvailable(dst: DoubleArray, offset: Int, length: Int): Int
expect open fun readAvailable(dst: FloatArray, offset: Int, length: Int): Int
expect open fun readAvailable(dst: IntArray, offset: Int, length: Int): Int
expect open fun readAvailable(dst: LongArray, offset: Int, length: Int): Int
expect open fun readAvailable(dst: ShortArray, offset: Int, length: Int): Int
override fun readAvailable(dst: IoBuffer, length: Int): Int
override fun readAvailable(dst: ByteBuffer, length: Int): Int
override fun readAvailable(dst: ByteArray, offset: Int, length: Int): Int
override fun readAvailable(dst: DoubleArray, offset: Int, length: Int): Int
override fun readAvailable(dst: FloatArray, offset: Int, length: Int): Int
override fun readAvailable(dst: IntArray, offset: Int, length: Int): Int
override fun readAvailable(dst: LongArray, offset: Int, length: Int): Int
override fun readAvailable(dst: ShortArray, offset: Int, length: Int): Int
override fun readAvailable(dst: IoBuffer, length: Int): Int
override fun readAvailable(dst: <ERROR CLASS><<ERROR CLASS>>, offset: Int, length: Int): Int
override fun readAvailable(dst: <ERROR CLASS><<ERROR CLASS>>, offset: Long, length: Long): Long
override fun readAvailable(dst: ByteArray, offset: Int, length: Int): Int
override fun readAvailable(dst: DoubleArray, offset: Int, length: Int): Int
override fun readAvailable(dst: FloatArray, offset: Int, length: Int): Int
override fun readAvailable(dst: IntArray, offset: Int, length: Int): Int
override fun readAvailable(dst: LongArray, offset: Int, length: Int): Int
override fun readAvailable(dst: ShortArray, offset: Int, length: Int): Int
Link copied to clipboard
expect abstract fun readByte(): Byte

Read the next upcoming byte

actual abstract fun readByte(): Byte
actual abstract fun readByte(): Byte

Read the next upcoming byte

Link copied to clipboard
inline fun readDirect(block: (ByteBuffer) -> Unit): Int

Apply block function on a ByteBuffer of readable bytes. The block function should return number of consumed bytes.

fun readDirect(block: (<ERROR CLASS><<ERROR CLASS>>) -> Int): Int

Apply block to a native pointer for reading from the buffer. Lambda should return number of bytes were read.

Link copied to clipboard
expect open fun readDouble(): Double
override fun readDouble(): Double
override fun readDouble(): Double
Link copied to clipboard
expect open fun readFloat(): Float
override fun readFloat(): Float
override fun readFloat(): Float
Link copied to clipboard
expect open fun readFully(dst: IoBuffer, length: Int)
expect open fun readFully(dst: ByteArray, offset: Int, length: Int)
expect open fun readFully(dst: DoubleArray, offset: Int, length: Int)
expect open fun readFully(dst: FloatArray, offset: Int, length: Int)
expect open fun readFully(dst: IntArray, offset: Int, length: Int)
expect open fun readFully(dst: LongArray, offset: Int, length: Int)
expect open fun readFully(dst: ShortArray, offset: Int, length: Int)
override fun readFully(dst: IoBuffer, length: Int)
override fun readFully(dst: ByteBuffer, length: Int)
override fun readFully(dst: ByteArray, offset: Int, length: Int)
override fun readFully(dst: DoubleArray, offset: Int, length: Int)
override fun readFully(dst: FloatArray, offset: Int, length: Int)
override fun readFully(dst: IntArray, offset: Int, length: Int)
override fun readFully(dst: LongArray, offset: Int, length: Int)
override fun readFully(dst: ShortArray, offset: Int, length: Int)
override fun readFully(dst: IoBuffer, length: Int)
override fun readFully(dst: <ERROR CLASS><<ERROR CLASS>>, offset: Int, length: Int)
override fun readFully(dst: <ERROR CLASS><<ERROR CLASS>>, offset: Long, length: Long)
override fun readFully(dst: ByteArray, offset: Int, length: Int)
override fun readFully(dst: DoubleArray, offset: Int, length: Int)
override fun readFully(dst: FloatArray, offset: Int, length: Int)
override fun readFully(dst: IntArray, offset: Int, length: Int)
override fun readFully(dst: LongArray, offset: Int, length: Int)
override fun readFully(dst: ShortArray, offset: Int, length: Int)
Link copied to clipboard
expect open fun readInt(): Int
override fun readInt(): Int
override fun readInt(): Int
Link copied to clipboard
expect open fun readLong(): Long
override fun readLong(): Long
override fun readLong(): Long
Link copied to clipboard
expect open fun readShort(): Short
override fun readShort(): Short
override fun readShort(): Short
Link copied to clipboard
fun readText(decoder: CharsetDecoder, out: Appendable, lastBuffer: Boolean, max: Int = Int.MAX_VALUE): Int
Link copied to clipboard
open fun release(pool: ObjectPool<ChunkBuffer>)
expect fun release(pool: ObjectPool<IoBuffer>)
open fun release(pool: ObjectPool<ChunkBuffer>)
actual fun release(pool: ObjectPool<IoBuffer>)
open fun release(pool: ObjectPool<ChunkBuffer>)
actual fun release(pool: ObjectPool<IoBuffer>)
Link copied to clipboard
fun reserveEndGap(endGap: Int)

Reserve endGap bytes in the end. Could move readPosition and writePosition to reserve space but only when no bytes were written or all written bytes are marked as consumed (were read or discarded).

fun reserveEndGap(endGap: Int)

Reserve endGap bytes in the end. Could move readPosition and writePosition to reserve space but only when no bytes were written or all written bytes are marked as consumed (were read or discarded).

fun reserveEndGap(endGap: Int)

Reserve endGap bytes in the end. Could move readPosition and writePosition to reserve space but only when no bytes were written or all written bytes are marked as consumed (were read or discarded).

Link copied to clipboard
fun reserveStartGap(startGap: Int)

Reserve startGap bytes in the beginning. May move readPosition and writePosition if no bytes available for reading.

fun reserveStartGap(startGap: Int)

Reserve startGap bytes in the beginning. May move readPosition and writePosition if no bytes available for reading.

fun reserveStartGap(startGap: Int)

Reserve startGap bytes in the beginning. May move readPosition and writePosition if no bytes available for reading.

Link copied to clipboard
override fun reset()

Clear buffer's state: read/write positions, gaps and so on. Byte content is not cleaned-up.

override fun reset()

Clear buffer's state: read/write positions, gaps and so on. Byte content is not cleaned-up.

override fun reset()

Clear buffer's state: read/write positions, gaps and so on. Byte content is not cleaned-up.

Link copied to clipboard
fun resetForRead()

Marks the whole buffer available for read and no for write

fun resetForRead()

Marks the whole buffer available for read and no for write

fun resetForRead()

Marks the whole buffer available for read and no for write

Link copied to clipboard
fun resetForWrite()

Marks all capacity writable except the start gap reserved before. The end gap reservation is discarded.

fun resetForWrite(limit: Int)

Marks up to limit bytes of the buffer available for write and no bytes for read. It does respect startGap already reserved. All extra bytes after the specified limit are considered as endGap.

fun resetForWrite()

Marks all capacity writable except the start gap reserved before. The end gap reservation is discarded.

fun resetForWrite(limit: Int)

Marks up to limit bytes of the buffer available for write and no bytes for read. It does respect startGap already reserved. All extra bytes after the specified limit are considered as endGap.

fun resetForWrite()

Marks all capacity writable except the start gap reserved before. The end gap reservation is discarded.

fun resetForWrite(limit: Int)

Marks up to limit bytes of the buffer available for write and no bytes for read. It does respect startGap already reserved. All extra bytes after the specified limit are considered as endGap.

Link copied to clipboard
fun resetFromContentToWrite(child: ByteBuffer)

Reset read/write position to original's content pos/limit. May not work due to slicing.

Link copied to clipboard
fun rewind(count: Int = readPosition - startGap)

Rewind readPosition backward to make count bytes available for reading again.

fun rewind(count: Int = readPosition - startGap)

Rewind readPosition backward to make count bytes available for reading again.

fun rewind(count: Int = readPosition - startGap)

Rewind readPosition backward to make count bytes available for reading again.

Link copied to clipboard
fun setNext(newNext: IoBuffer?)
Link copied to clipboard
open override fun toString(): String
open override fun toString(): String
Link copied to clipboard
expect abstract fun tryPeek(): Int
override fun tryPeek(): Int
override fun tryPeek(): Int
Link copied to clipboard
fun tryPeekByte(): Int

Peek the next unsigned byte or return -1 if no more bytes available for reading. No bytes will be marked as consumed in any case.

fun tryPeekByte(): Int

Peek the next unsigned byte or return -1 if no more bytes available for reading. No bytes will be marked as consumed in any case.

fun tryPeekByte(): Int

Peek the next unsigned byte or return -1 if no more bytes available for reading. No bytes will be marked as consumed in any case.

Link copied to clipboard
fun tryReadByte(): Int

Read the next unsigned byte or return -1 if no more bytes available for reading. The returned byte is marked as consumed.

fun tryReadByte(): Int

Read the next unsigned byte or return -1 if no more bytes available for reading. The returned byte is marked as consumed.

fun tryReadByte(): Int

Read the next unsigned byte or return -1 if no more bytes available for reading. The returned byte is marked as consumed.

Link copied to clipboard
fun write(src: ByteBuffer)
fun write(src: ByteArray, offset: Int, length: Int)
Link copied to clipboard
fun writeBuffer(src: IoBuffer, length: Int): Int
Link copied to clipboard
expect abstract fun writeByte(v: Byte)
actual abstract fun writeByte(v: Byte)
actual abstract fun writeByte(v: Byte)
Link copied to clipboard
inline fun writeDirect(size: Int, block: (ByteBuffer) -> Unit): Int

Apply block function on a ByteBuffer of the free space. The block function should return number of written bytes.

fun writeDirect(block: (<ERROR CLASS><<ERROR CLASS>>) -> Int): Int

Apply block to a native pointer for writing to the buffer. Lambda should return number of bytes were written.

Link copied to clipboard
expect open fun writeDouble(v: Double)
override fun writeDouble(v: Double)
override fun writeDouble(v: Double)
Link copied to clipboard
expect open fun writeFloat(v: Float)
override fun writeFloat(v: Float)
override fun writeFloat(v: Float)
Link copied to clipboard
expect open fun writeFully(src: IoBuffer, length: Int)
expect open fun writeFully(src: ByteArray, offset: Int, length: Int)
expect open fun writeFully(src: DoubleArray, offset: Int, length: Int)
expect open fun writeFully(src: FloatArray, offset: Int, length: Int)
expect open fun writeFully(src: IntArray, offset: Int, length: Int)
expect open fun writeFully(src: LongArray, offset: Int, length: Int)
expect open fun writeFully(src: ShortArray, offset: Int, length: Int)
open override fun writeFully(bb: ByteBuffer)
override fun writeFully(src: IoBuffer, length: Int)
override fun writeFully(src: ByteArray, offset: Int, length: Int)
override fun writeFully(src: DoubleArray, offset: Int, length: Int)
override fun writeFully(src: FloatArray, offset: Int, length: Int)
override fun writeFully(src: IntArray, offset: Int, length: Int)
override fun writeFully(src: LongArray, offset: Int, length: Int)
override fun writeFully(src: ShortArray, offset: Int, length: Int)
override fun writeFully(src: IoBuffer, length: Int)
override fun writeFully(src: <ERROR CLASS><<ERROR CLASS>>, offset: Int, length: Int)
override fun writeFully(src: <ERROR CLASS><<ERROR CLASS>>, offset: Long, length: Long)
override fun writeFully(src: ByteArray, offset: Int, length: Int)
override fun writeFully(src: DoubleArray, offset: Int, length: Int)
override fun writeFully(src: FloatArray, offset: Int, length: Int)
override fun writeFully(src: IntArray, offset: Int, length: Int)
override fun writeFully(src: LongArray, offset: Int, length: Int)
override fun writeFully(src: ShortArray, offset: Int, length: Int)
Link copied to clipboard
expect open fun writeInt(v: Int)
override fun writeInt(v: Int)
override fun writeInt(v: Int)
Link copied to clipboard
expect open fun writeLong(v: Long)
override fun writeLong(v: Long)
override fun writeLong(v: Long)
Link copied to clipboard
expect open fun writeShort(v: Short)
override fun writeShort(v: Short)
override fun writeShort(v: Short)

Properties

Link copied to clipboard
var attachment: Any?

User data: could be a session, connection or anything useful

Link copied to clipboard
var attachment: Any?

User data: could be a session, connection or anything useful

Link copied to clipboard
var attachment: Any?

User data: could be a session, connection or anything useful

Link copied to clipboard
expect override var byteOrder: ByteOrder
actual override var byteOrder: ByteOrder

read and write operations byte-order (endianness)

actual override var byteOrder: ByteOrder
Link copied to clipboard
val capacity: Int

Buffer's capacity (including reserved startGap and endGap). Value for released buffer is unspecified.

Link copied to clipboard
val capacity: Int

Buffer's capacity (including reserved startGap and endGap). Value for released buffer is unspecified.

Link copied to clipboard
val capacity: Int

Buffer's capacity (including reserved startGap and endGap). Value for released buffer is unspecified.

Link copied to clipboard
val endGap: Int

Number of bytes reserved in the end.

Link copied to clipboard
val endGap: Int

Number of bytes reserved in the end.

Link copied to clipboard
val endGap: Int

Number of bytes reserved in the end.

Link copied to clipboard
open override val endOfInput: Boolean

It is true when it is known that no more bytes will be available. When it is false then this means that it is not known yet or there are available bytes. Please note that false value doesn't guarantee that there are available bytes so readByte() may fail.

Link copied to clipboard
open override val endOfInput: Boolean

It is true when it is known that no more bytes will be available. When it is false then this means that it is not known yet or there are available bytes. Please note that false value doesn't guarantee that there are available bytes so readByte() may fail.

Link copied to clipboard
expect abstract val endOfInput: Boolean

It is true when it is known that no more bytes will be available. When it is false then this means that it is not known yet or there are available bytes. Please note that false value doesn't guarantee that there are available bytes so readByte() may fail.

Link copied to clipboard
var limit: Int

Write position limit. No bytes could be written ahead of this limit. When the limit is less than the capacity then this means that there are reserved bytes in the end (endGap). Such a reserved space in the end could be used to write size, hash and so on. Also it is useful when several buffers are connected into a chain and some primitive value (e.g. kotlin.Int) is separated into two chunks so bytes from the second chain could be copied to the reserved space of the first chunk and then the whole value could be read at once.

Link copied to clipboard
var limit: Int

Write position limit. No bytes could be written ahead of this limit. When the limit is less than the capacity then this means that there are reserved bytes in the end (endGap). Such a reserved space in the end could be used to write size, hash and so on. Also it is useful when several buffers are connected into a chain and some primitive value (e.g. kotlin.Int) is separated into two chunks so bytes from the second chain could be copied to the reserved space of the first chunk and then the whole value could be read at once.

Link copied to clipboard
var limit: Int

Write position limit. No bytes could be written ahead of this limit. When the limit is less than the capacity then this means that there are reserved bytes in the end (endGap). Such a reserved space in the end could be used to write size, hash and so on. Also it is useful when several buffers are connected into a chain and some primitive value (e.g. kotlin.Int) is separated into two chunks so bytes from the second chain could be copied to the reserved space of the first chunk and then the whole value could be read at once.

Link copied to clipboard
val memory: Memory
Link copied to clipboard
val memory: Memory
Link copied to clipboard
val memory: Memory
Link copied to clipboard
var next: ChunkBuffer?

Reference to next buffer view. Useful to chain multiple views.

Link copied to clipboard
var next: ChunkBuffer?

Reference to next buffer view. Useful to chain multiple views.

Link copied to clipboard
var next: ChunkBuffer?

Reference to next buffer view. Useful to chain multiple views.

Link copied to clipboard
var origin: ChunkBuffer?

Reference to an origin buffer view this was copied from

Link copied to clipboard
var origin: ChunkBuffer?

Reference to an origin buffer view this was copied from

Link copied to clipboard
var origin: ChunkBuffer?

Reference to an origin buffer view this was copied from

Link copied to clipboard
var readPosition: Int

Current read position. It is always non-negative and will never run ahead of the writePosition. It is usually greater or equal to startGap reservation. This position is affected by discard, rewind, resetForRead, resetForWrite, reserveStartGap and reserveEndGap.

Link copied to clipboard
var readPosition: Int

Current read position. It is always non-negative and will never run ahead of the writePosition. It is usually greater or equal to startGap reservation. This position is affected by discard, rewind, resetForRead, resetForWrite, reserveStartGap and reserveEndGap.

Link copied to clipboard
var readPosition: Int

Current read position. It is always non-negative and will never run ahead of the writePosition. It is usually greater or equal to startGap reservation. This position is affected by discard, rewind, resetForRead, resetForWrite, reserveStartGap and reserveEndGap.

Link copied to clipboard
val readRemaining: Int

Number of bytes available for reading.

Link copied to clipboard
val readRemaining: Int

Number of bytes available for reading.

Link copied to clipboard
val readRemaining: Int

Number of bytes available for reading.

Link copied to clipboard
val referenceCount: Int
Link copied to clipboard
val referenceCount: Int
Link copied to clipboard
val referenceCount: Int
Link copied to clipboard
var startGap: Int

Start gap is a reserved space in the beginning. The reserved space is usually used to write a packet length in the case when it's not known before the packet constructed.

Link copied to clipboard
var startGap: Int

Start gap is a reserved space in the beginning. The reserved space is usually used to write a packet length in the case when it's not known before the packet constructed.

Link copied to clipboard
var startGap: Int

Start gap is a reserved space in the beginning. The reserved space is usually used to write a packet length in the case when it's not known before the packet constructed.

Link copied to clipboard
var writePosition: Int

Current write position. It is always non-negative and will never run ahead of the limit. It is always greater or equal to the readPosition.

Link copied to clipboard
var writePosition: Int

Current write position. It is always non-negative and will never run ahead of the limit. It is always greater or equal to the readPosition.

Link copied to clipboard
var writePosition: Int

Current write position. It is always non-negative and will never run ahead of the limit. It is always greater or equal to the readPosition.

Link copied to clipboard
val writeRemaining: Int

Size of the free space available for writing in bytes.

Link copied to clipboard
val writeRemaining: Int

Size of the free space available for writing in bytes.

Link copied to clipboard
val writeRemaining: Int

Size of the free space available for writing in bytes.

Extensions

Link copied to clipboard
inline fun IoBuffer.decodeUTF8(consumer: (Char) -> Boolean): Int
Link copied to clipboard
inline fun IoBuffer.readAvailable(destination: ByteArray, offset: Int = 0, length: Int = destination.size - offset): Int
Link copied to clipboard
inline fun IoBuffer.readDouble(): Double
Link copied to clipboard
inline fun IoBuffer.readFloat(): Float
Link copied to clipboard
inline fun IoBuffer.readFully(destination: ByteArray, offset: Int = 0, length: Int = destination.size - offset)
Link copied to clipboard
inline fun IoBuffer.readInt(): Int
Link copied to clipboard
inline fun IoBuffer.readLong(): Long
Link copied to clipboard
inline fun IoBuffer.readShort(): Short
Link copied to clipboard
inline fun IoBuffer.readUByte(): UByte
Link copied to clipboard
inline fun IoBuffer.readUInt(): UInt
Link copied to clipboard
inline fun IoBuffer.readULong(): ULong
Link copied to clipboard
inline fun IoBuffer.readUShort(): UShort
Link copied to clipboard
fun IoBuffer.release(pool: ObjectPool<IoBuffer>)

releases buffer view and returns it to the pool if there are no more usages. Based on simple ref-counting so it is very fragile.

Link copied to clipboard
inline fun IoBuffer.writeDouble(value: Double)
Link copied to clipboard
inline fun IoBuffer.writeFloat(value: Float)
Link copied to clipboard
inline fun IoBuffer.writeFully(source: ByteArray, offset: Int = 0, length: Int = source.size - offset)
Link copied to clipboard
inline fun IoBuffer.writeInt(value: Int)
Link copied to clipboard
inline fun IoBuffer.writeLong(value: Long)
Link copied to clipboard
inline fun IoBuffer.writeShort(value: Short)
Link copied to clipboard
fun IoBuffer.writeUByte(value: UByte)
Link copied to clipboard
inline fun IoBuffer.writeUInt(value: UInt)
Link copied to clipboard
inline fun IoBuffer.writeULong(value: ULong)
Link copied to clipboard
inline fun IoBuffer.writeUShort(value: UShort)