popShort

fun ByteDeque.popShort(littleEndian: Boolean = false): Short

Takes the first 2 bytes from the backing ByteDeque and translates them into a Short value.

This method makes no attempt to verify that the backing ByteDeque actually contains at least 2 bytes. This means, when called on a ByteDeque instance containing less than 2 bytes, this method will cause a NoSuchElementException to be thrown after the available byte has been popped from the head of the deque. Callers should verify the length of the deque before attempting to call this method.

Parameters

littleEndian

Boolean flag indicating whether the bytes in the deque should be translated to an int with a little endian byte order.

Defaults to false (big endian).

Throws

If called on a deque instance with fewer than 2 bytes. This exception will only be thrown after the byte available in the deque have been consumed.