FlexiByteArray

A ByteArray with the capabilities of a FlexiByte.

Allows modification of the ending byte's individual bits.

Author

Ron Lauren Hombre

Constructors

Link copied to clipboard
constructor(size: Int, init: (Int) -> Byte)

Create a FlexiByteArray with a specific size and initialize with a specific value.

constructor(byteArray: ByteArray, bitIndex: Int = 7)

Wrap a ByteArray and set the bit index of the last byte.

Properties

Link copied to clipboard

The index of the last bit.

Link copied to clipboard

The indices of this array.

Link copied to clipboard

The last index of this array.

Link copied to clipboard
val size: Int

The size of this array.

Functions

Link copied to clipboard

Fill all the leftover bits at the end to complete a byte.

Link copied to clipboard
fun copyInto(flexiByteArray: FlexiByteArray, destinationOffset: Int = 0)

Copy values into another FlexiByteArray.

Link copied to clipboard

Create an independent copy of this class.

Link copied to clipboard
fun extend(nBytes: Int)

Extend the array by a specified length.

Link copied to clipboard
fun fill(byte: Byte)

Fill all the bytes in this array with the specified byte value.

Link copied to clipboard
operator fun get(index: Int): Byte
Link copied to clipboard
operator fun iterator(): ByteIterator
Link copied to clipboard
fun moveBitIndex(index: Int)

Manually move the bit index.

Link copied to clipboard
operator fun plus(flexiByte: FlexiByte): FlexiByteArray
Link copied to clipboard
fun reset()

Reset the bit index to 7.

Link copied to clipboard
operator fun set(index: Int, value: Byte)
Link copied to clipboard

Convert to a ByteArray.