writeLines

Platform and version requirements: JVM (1.5), JRE7 (1.5)
fun Path.writeLines(
    lines: Iterable<CharSequence>, 
    charset: Charset = Charsets.UTF_8, 
    vararg options: OpenOption
): Path

Write the specified collection of char sequences lines to a file terminating each one with the platform's line separator.

By default, the file will be overwritten if it already exists, but you can control this behavior with options.

Parameters

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

Platform and version requirements: JVM (1.5), JRE7 (1.5)
fun Path.writeLines(
    lines: Sequence<CharSequence>, 
    charset: Charset = Charsets.UTF_8, 
    vararg options: OpenOption
): Path

Write the specified sequence of char sequences lines to a file terminating each one with the platform's line separator.

By default, the file will be overwritten if it already exists, but you can control this behavior with options.

Parameters

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

© 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/write-lines.html