BytePacketBuilderBase

abstract class BytePacketBuilderBase : AbstractOutput

Deprecated: Will be removed in future releases

Inherited Properties

_size

var _size: Int

Number of bytes currently buffered (pending).

byteOrder

var byteOrder: ByteOrder

Byte order (Endianness) to be used by future write functions calls on this builder instance. Doesn’t affect any previously written values.

currentTail

var currentTail: ChunkBuffer

pool

Inherited Functions

afterHeadWrite

fun afterHeadWrite(): Unit

append

open fun append(c: Char): AbstractOutput

Append single UTF-8 character

open fun append(csq: CharSequence?): AbstractOutput
open fun append(
    csq: CharSequence?,
    start: Int,
    end: Int
): AbstractOutput
open fun append(
    csq: CharArray,
    start: Int,
    end: Int
): Appendable

appendNewBuffer

fun appendNewBuffer(): IoBuffer

close

fun close(): Unit

Should flush and close the destination

closeDestination

abstract fun closeDestination(): Unit

An implementation should only close the destination.

flush

abstract fun flush(
    source: Memory,
    offset: Int,
    length: Int
): Unit

An implementation should write source to the destination exactly length bytes. It should never capture the source instance longer than this method execution since it may be disposed after return.

fun flush(): Unit

prepareWriteHead

fun prepareWriteHead(n: Int): ChunkBuffer

release

fun release(): Unit

Release any resources that the builder holds. Builder shouldn’t be used after release

reset

open fun reset(): Unit

writeByte

fun writeByte(v: Byte): Unit

writePacket

fun writePacket(p: ByteReadPacket): Unit

Writes another packet to the end. Please note that the instance p gets consumed so you don’t need to release it

fun writePacket(p: ByteReadPacket, n: Int): Unit
fun writePacket(p: ByteReadPacket, n: Long): Unit

Write exact n bytes from packet to the builder

writeStringUtf8

fun writeStringUtf8(s: String): Unit
fun writeStringUtf8(cs: CharSequence): Unit

Extension Functions

afterHeadWrite

fun Output.afterHeadWrite(current: IoBuffer): Unit
fun Output.afterHeadWrite(current: ChunkBuffer): Unit

append

fun Output.append(
    csq: CharSequence,
    start: Int = 0,
    end: Int = csq.length
): Appendable
fun Output.append(
    csq: CharArray,
    start: Int = 0,
    end: Int = csq.size
): Appendable

fill

fun Output.fill(times: Long, value: Byte = 0): Unit

prepareWriteHead

fun Output.prepareWriteHead(
    capacity: Int,
    current: IoBuffer?
): IoBuffer
fun Output.prepareWriteHead(
    capacity: Int,
    current: ChunkBuffer?
): ChunkBuffer

writeDouble

fun Output.writeDouble(
    value: Double,
    byteOrder: ByteOrder
): Unit
fun Output.writeDouble(value: Double): Unit

writeDoubleLittleEndian

fun Output.writeDoubleLittleEndian(value: Double): Unit

writeFloat

fun Output.writeFloat(
    value: Float,
    byteOrder: ByteOrder
): Unit
fun Output.writeFloat(value: Float): Unit

writeFloatLittleEndian

fun Output.writeFloatLittleEndian(value: Float): Unit

writeFully

fun Output.writeFully(
    src: ByteArray,
    offset: Int = 0,
    length: Int = src.size - offset
): Unit
fun Output.writeFully(
    src: ShortArray,
    offset: Int = 0,
    length: Int = src.size - offset
): Unit
fun Output.writeFully(
    src: IntArray,
    offset: Int = 0,
    length: Int = src.size - offset
): Unit
fun Output.writeFully(
    src: LongArray,
    offset: Int = 0,
    length: Int = src.size - offset
): Unit
fun Output.writeFully(
    src: FloatArray,
    offset: Int = 0,
    length: Int = src.size - offset
): Unit
fun Output.writeFully(
    src: DoubleArray,
    offset: Int = 0,
    length: Int = src.size - offset
): Unit
fun Output.writeFully(
    src: IoBuffer,
    length: Int = src.readRemaining
): Unit
fun Output.writeFully(
    src: Buffer,
    length: Int = src.readRemaining
): Unit
fun Output.writeFully(
    src: Memory,
    offset: Int,
    length: Int
): Unit
fun Output.writeFully(
    src: Memory,
    offset: Long,
    length: Long
): Unit
fun Output.writeFully(
    array: <ERROR CLASS>,
    offset: Int = 0,
    length: Int = array.size - offset
): Unit
fun Output.writeFully(bb: ByteBuffer): Unit

writeFullyLittleEndian

fun Output.writeFullyLittleEndian(
    source: <ERROR CLASS>,
    offset: Int = 0,
    length: Int = source.size - offset
): Unit
fun Output.writeFullyLittleEndian(
    source: ShortArray,
    offset: Int = 0,
    length: Int = source.size - offset
): Unit
fun Output.writeFullyLittleEndian(
    source: IntArray,
    offset: Int = 0,
    length: Int = source.size - offset
): Unit
fun Output.writeFullyLittleEndian(
    source: LongArray,
    offset: Int = 0,
    length: Int = source.size - offset
): Unit
fun Output.writeFullyLittleEndian(
    source: FloatArray,
    offset: Int = 0,
    length: Int = source.size - offset
): Unit
fun Output.writeFullyLittleEndian(
    source: DoubleArray,
    offset: Int = 0,
    length: Int = source.size - offset
): Unit

writeInt

fun Output.writeInt(value: Int, byteOrder: ByteOrder): Unit
fun Output.writeInt(value: Int): Unit

writeIntLittleEndian

fun Output.writeIntLittleEndian(value: Int): Unit

writeLong

fun Output.writeLong(value: Long, byteOrder: ByteOrder): Unit
fun Output.writeLong(value: Long): Unit

writeLongLittleEndian

fun Output.writeLongLittleEndian(value: Long): Unit

writePacket

fun Output.writePacket(packet: ByteReadPacket): Unit

writeShort

fun Output.writeShort(
    value: Short,
    byteOrder: ByteOrder
): Unit
fun Output.writeShort(value: Short): Unit

writeShortLittleEndian

fun Output.writeShortLittleEndian(value: Short): Unit

writeText

fun Output.writeText(
    text: CharSequence,
    fromIndex: Int = 0,
    toIndex: Int = text.length,
    encoder: CharsetEncoder
): Unit

Writes text characters in range [fromIndex .. toIndex) with the specified encoder

fun Output.writeText(
    text: CharSequence,
    fromIndex: Int = 0,
    toIndex: Int = text.length,
    charset: Charset = Charsets.UTF_8
): Unit
fun Output.writeText(
    text: CharArray,
    fromIndex: Int = 0,
    toIndex: Int = text.size,
    charset: Charset = Charsets.UTF_8
): Unit

Writes text characters in range [fromIndex .. toIndex) with the specified charset

writeUByte

fun Output.writeUByte(v: <ERROR CLASS>): Unit

writeUInt

fun Output.writeUInt(v: <ERROR CLASS>): Unit

writeULong

fun Output.writeULong(v: <ERROR CLASS>): Unit

writeUShort

fun Output.writeUShort(v: <ERROR CLASS>): Unit

writeWhile

fun Output.writeWhile(block: (Buffer) -> Boolean): Unit

Append number of chunks invoking block function while the returned value is true. Depending on the output underlying implementation it could invoke block function with the same buffer several times however it is guaranteed that it is always non-empty.

writeWhileSize

fun Output.writeWhileSize(
    initialSize: Int = 1,
    block: (Buffer) -> Int
): Unit

Append number of chunks invoking block function while the returned value is positive. If returned value is positive then it will be invoked again with a buffer having at least requested number of bytes space (could be the same buffer as before if it complies to the restriction).

Inheritors

BytePacketBuilderPlatformBase

abstract class BytePacketBuilderPlatformBase : 
    BytePacketBuilderBase