writeUShort

Writes two bytes containing short, in the big-endian order, to this sink.

Parameters

short

the unsigned short integer to be written.

Throws

when the sink is closed.

when some I/O error occurs.

Samples

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

fun main() { 
   //sampleStart 
   val buffer = Buffer()
buffer.writeUShort(65535U)

assertContentEquals(byteArrayOf(-1, -1), buffer.readByteArray()) 
   //sampleEnd
}