NybbleOutputStream

class NybbleOutputStream(initialCapacity: Int = 0)

NybbleOutputStream writes a dense stream of nybbles, i.e., values in 0,15, backed by an underlying ByteArrayOutputStream.

Author

Todd L Smith

Parameters

initialCapacity

The initial capacity of the underlying data storage, in nybbles.

Constructors

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

Properties

Link copied to clipboard
val size: Int

The number of nybbles presently stored.

Functions

Link copied to clipboard

Apply a variable-length universal coding strategy to the supplied value, encoding it onto the receiver. The coding is not efficient for large instruction sets, but is quite efficient for a very small instruction set, i.e., fewer than 32 instructions.

Link copied to clipboard

Answer a NybbleArray that contains the contents of the receiver. The answered array is disjoint from the receiver's underlying storage, and may be safely modified by the caller.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Apply a variable-length universal coding strategy to the supplied value, encoding it onto the receiver using a nybble-based variant of MIDI VLQ. The value must be non-negative.

Link copied to clipboard
fun write(nybble: Int)

Append the given nybble.