kotlinx.serialization.csv.decode.Source.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlinx-serialization-csv Show documentation
Show all versions of kotlinx-serialization-csv Show documentation
Library to easily use Kotlin Serialization to serialize to/from CSV.
package kotlinx.serialization.csv.decode
/**
* Stream that allow to read [Char]s from.
*/
interface Source {
/**
* Check if there are more characters to read.
* @return True if EOF has not been read, yet; false if EOF has already been read.
*/
fun canRead(): Boolean
/**
* Read one [Char] from the stream.
* @return The read [Char] or `null` if stream reached EOF.
*/
fun read(): Char?
/**
* Return the next [Char] from the stream without actually reading it.
* @return The next [Char] or `null` if stream reached EOF.
*/
fun peek(): Char?
/**
* Mark the current position in the stream. Calling [reset] afterwards resets the stream to this marked position.
*
* Calling [mark] must be proceeded by a call to [reset] or [unmark].
*/
fun mark()
/**
* Remove the last [mark] without resetting the stream to the marked position.
*/
fun unmark()
/**
* Reset the stream to the last [mark]ed position (and remove the mark).
*/
fun reset()
}