public FileWriter(filePath as Path, append as Boolean = false, encoding as String = "utf-8"):
Creates a file text writer and truncates the target file.
| Parameter | Description |
|---|---|
filePath | File to write. |
append | Whether to append instead of truncating the file. |
encoding | Text encoding. Only UTF-8 is currently supported. |
try writer = FileWriter(Path("notes.txt"), append=true, encoding="utf-8"):
writer.writeLine("hello")