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

forEachLine

JVM
JRE7
1.5
inline fun Path . forEachLine (
charset : Charset = Charsets.UTF_8 ,
action : ( line : String ) -> Unit )

(source)

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 for reading text, UTF-8 by default.

action - function to process 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 .