klyn.io.Files.writeTextAtomic
method
public static writeTextAtomic(path as Path, content as String) as Void
Description

Publishes UTF-8 text by replacing a file atomically, without a partially written destination. The temporary file resides beside the destination. On POSIX, the published file is readable and writable by its owner only. This does not serialize concurrent read/modify/write operations.

Parameters
ParameterDescription
pathDestination; its parent directory must already exist.
contentText to publish, including embedded U+0000 characters.
Throws
  • IOException if writing or replacing the destination fails.
Example
Files.writeTextAtomic(Path("settings.json"), "{}")