writeInt

abstract fun writeInt(int: Int)(source)

Writes four bytes containing int, in the big-endian order, to this sink.

Parameters

int

the 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.writeInt(42)
assertContentEquals(byteArrayOf(0, 0, 0, 42), buffer.readByteArray()) 
   //sampleEnd
}