forEachLine

fun File.forEachLine(
    charset: Charset = Charsets.UTF_8,
    action: (line: String) -> Unit)
(source)

Platform and version requirements: JVM

Reads this file line by line using the specified charset and calls action for each line. Default charset is UTF-8.

You may use this function on huge files.

Parameters

charset - character set to use.

action - function to process file lines.