writeShort

open override fun writeShort(short: Short)(source)

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

Parameters

short

the short integer to be written.

Throws

when the sink is closed.

Samples

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

fun main() { 
   //sampleStart 
   val buffer = Buffer()

buffer.writeShort(42)
assertContentEquals(byteArrayOf(0, 42), buffer.readByteArray()) 
   //sampleEnd
}