reader

Returns a new FileReader for reading the content of this file.

inline fun File.reader(charset: Charset = Charsets.UTF_8): InputStreamReader(source)
import java.io.File

fun main() {
    val file = File("example.txt")

    // Use the reader to read the file line by line
    file.reader().use { reader ->
        reader.lineSequence().forEach { line ->
            println(line)
        }
    }
}

Source