FileWriter
class in package klyn.io

    public class FileWriter extends AbstractTextWriter:

AbstractTextWriter
└ FileWriter

Text writer backed by one file.

Opening the writer truncates the target file.

    import klyn.io

    try writer = FileWriter("notes.txt"):
    writer.writeLine("hello")

Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | FileWriter `FileWriter(filePath as Path, append as Boolean = false, encoding as String = "utf-8"):` | Creates a file text writer and truncates the target file.
public | FileWriter `FileWriter(filePath as String, append as Boolean = false, encoding as String = "utf-8"):` | Creates a file text writer and truncates the target file.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public override | close `close() as Void throws IOException:` | Closes the writer.
public override | write `write(readonly value as String) as Void throws IOException:` | Writes raw text to the file.

Inherited Methods
method Inherited Methods from AbstractTextWriter: close, write, writeChar, writeLine, writeLines
method Inherited Methods from TextWriter: write, writeChar, writeLine, writeLines
method Inherited Methods from AutoClosable: close