readLines

Platform and version requirements: JVM (1.5), JRE7 (1.5)
fun Path.readLines(
    charset: Charset = Charsets.UTF_8
): List<String>

Reads the file content as a list of lines.

It's not recommended to use this function on huge files. For reading lines of a large file or a file of unknown size, use Path.forEachLine or Path.useLines.

Parameters

charset - character set to use for reading text, UTF-8 by default.

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.path/java.nio.file.-path/read-lines.html