← Docs
kotlin-stdlib / kotlin.io.path / java.nio.file.Path / readLines

readLines

JVM
JRE7
1.5
fun Path . readLines (
charset : Charset = Charsets.UTF_8
) : List < String >

(source)

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.

Stay in touch:
  • Contributing to Kotlin
  • Releases
  • Press Kit
  • Security
  • Blog
  • Issue Tracker
  • Brand assets
  • Careers
Supported and developed by JetBrains .
Kotlin™ is protected under the Kotlin Foundation
and licensed under the Apache 2 license .