ByteArrayBuilder

class ByteArrayBuilder(initialCapacity: Int = 64)

Grow-on-demand byte buffer. Pure Kotlin (no platform OutputStream), so it works in commonMain across every target, and it stores into a contiguous primitive array rather than boxing into a MutableList<Byte>. The bencode encoder and the peer wire-protocol codec both build their output through this.

Constructors

Link copied to clipboard
constructor(initialCapacity: Int = 64)

Properties

Link copied to clipboard
val size: Int

Functions

Link copied to clipboard
fun append(b: Byte)
fun append(bytes: ByteArray, offset: Int = 0, length: Int = bytes.size - offset)
Link copied to clipboard

Append the low byte of each char in s, for pure-ASCII tokens (bencode digits, ':').

Link copied to clipboard