writeShort
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.
when some I/O error occurs.
Writes two bytes containing short, in the big-endian order, to this sink.
the short integer to be written.
when the sink is closed.
when some I/O error occurs.
import kotlinx.io.* import kotlin.test.* fun main() { //sampleStart val buffer = Buffer() buffer.writeShort(42) assertContentEquals(byteArrayOf(0, 42), buffer.readByteArray()) //sampleEnd }
xxxxxxxxxx
val buffer = Buffer()
buffer.writeShort(42)
assertContentEquals(byteArrayOf(0, 42), buffer.readByteArray())