ByteArrayBuilder

class ByteArrayBuilder(initialCap: Int = 128)

Helper class to assist with building byte arrays. Works similarly to StringBuilder.

Constructors

Link copied to clipboard
constructor(initialCap: Int = 128)

Properties

Link copied to clipboard
val size: Int

Returns current size of the buffer.

Functions

Link copied to clipboard

Appends a single byte to the buffer.

fun append(array: ByteArray, srcRange: IntRange = array.indices)

Appends a byte array to the buffer, optionally by only copying a section of it as specified by srcRange.

Link copied to clipboard

Copies the contents of the buffer to a new ByteArray and returns the new array.