writeText

JVM
JRE7
1.4
@ExperimentalPathApi fun Path.writeText(
    text: CharSequence,
    charset: Charset = Charsets.UTF_8,
    vararg options: OpenOption)

Sets the content of this file as text encoded using UTF-8 or the specified charset.

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

Parameters

text - text to write into file.

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

options - options to determine how the file is opened.