startsWith
Return true
if the next byte to be consumed from this source is equal to byte. Otherwise, return false
as well as when the source is exhausted.
If there is no buffered data, this call will result in a fetch from the underlying source.
Throws
when the source is closed.
when some I/O error occurs.
Samples
import kotlinx.io.*
import kotlin.test.*
fun main() {
//sampleStart
val buffer = Buffer()
buffer.write(byteArrayOf(1, 2, 3, 4, 5))
assertTrue(buffer.startsWith(1))
assertFalse(buffer.startsWith(0))
buffer.clear()
assertFalse(buffer.startsWith(1))
//sampleEnd
}