Extensions for java.io.Reader
Platform and version requirements: JVM (1.0)
Returns a buffered reader wrapping this Reader, or this Reader itself if it is already buffered.
fun Reader.buffered(
bufferSize: Int = DEFAULT_BUFFER_SIZE
): BufferedReader
Platform and version requirements: JVM (1.0)
Copies this reader to the given out writer, returning the number of characters copied.
fun Reader.copyTo(
out: Writer,
bufferSize: Int = DEFAULT_BUFFER_SIZE
): Long
Platform and version requirements: JVM (1.0)
Iterates through each line of this reader, calls action for each line read and closes the Reader when it's completed.
fun Reader.forEachLine(action: (String) -> Unit)
Platform and version requirements: JVM (1.0)
Reads this reader content as a list of lines.
fun Reader.readLines(): List<String>
Platform and version requirements: JVM (1.0)
Reads this reader completely as a String.
fun Reader.readText(): String
Platform and version requirements: JVM (1.0)
Calls the block callback giving it a sequence of all the lines in this file and closes the reader once the processing is complete.
fun <T> Reader.useLines(block: (Sequence<String>) -> T): T