appendInt16

fun ByteStringBuilder.appendInt16(value: Int, validRange: IntRange = Int.MIN_VALUE..Int.MAX_VALUE): ByteStringBuilder

Appends a 16-bit signed integer to this ByteStringBuilder.

This function appends the value as two bytes to the end of this ByteStringBuilder. It also validates that the provided value is within the specified validRange. By default the valid range is from Short.MIN_VALUE to Short.MAX_VALUE.

The bytes are appended in Big-Endian order.

Return

This ByteStringBuilder instance, allowing for chaining of operations.

Parameters

value

The integer value to append.

validRange

The valid range for the integer value. Defaults to Short.MIN_VALUE..Short.MAX_VALUE.

Throws