readInt

abstract fun readInt(): Int(source)

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

Throws

when there are not enough data to read an int value.

when the source is closed.

Samples

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

fun main() { 
   //sampleStart 
   val buffer = Buffer()
buffer.write(byteArrayOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))

assertEquals(0x01020304, buffer.readInt())
assertEquals(6, buffer.size) 
   //sampleEnd
}