readUShort

Removes two bytes from this source and returns an unsigned short integer composed of it according to the big-endian order.

Throws

when there are not enough data to read an unsigned short value.

when the source is closed.

Samples

import kotlinx.io.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   val buffer = Buffer()
buffer.write(byteArrayOf(-1, -1))

assertEquals(65535U, buffer.readUShort()) 
   //sampleEnd
}