readDecimalLong

Reads a long from this source in signed decimal form (i.e., as a string in base 10 with optional leading -).

Source data will be consumed until the source is exhausted, the first occurrence of non-digit byte, or overflow happened during resulting value construction.

Throws

if the found digits do not fit into a long or a decimal number was not present.

if the source is exhausted before a call of this method.

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.writeString("42 -1 1234567!")

assertEquals(42L, buffer.readDecimalLong())
buffer.skip(1) // skip space
assertEquals(-1L, buffer.readDecimalLong())
buffer.skip(1) // skip space
assertEquals(1234567L, buffer.readDecimalLong())
buffer.skip(1) // skip ! 
   //sampleEnd
}