readLines

Platform and version requirements: JVM (1.0)
fun File.readLines(
    charset: Charset = Charsets.UTF_8
): List<String>

Reads the file content as a list of lines.

Do not use this function for huge files.

Parameters

charset - character set to use. By default uses UTF-8 charset.

Return list of file lines.

© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io/java.io.-file/read-lines.html