get

operator fun get(position: Long): Byte(source)

Returns the byte at position.

Use of this method may expose significant performance penalties and it's not recommended to use it for sequential access to a range of bytes within the buffer.

Throws

when position is negative or greater or equal to Buffer.size.

Samples

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

fun main() { 
   //sampleStart 
   val buffer = Buffer()
buffer.writeString("Hello World!")

assertEquals('H'.code, buffer[0].toInt())
assertEquals('W'.code, buffer[buffer.indexOf('W'.code.toByte())].toInt()) 
   //sampleEnd
}