FileWriter
classin packageklyn.io
public class FileWriter extends 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(notnull 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(notnull 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 flush
flush() as Void throws IOException
Flushes buffered text to the underlying file.
public override write
write(readonly value as String) as Void throws IOException
Writes raw text to the file.
Inherited Methods
methodInherited Methods from AbstractTextWriter: close, write, writeChar, writeLine, writeLines
methodInherited Methods from TextWriter: write
methodInherited Methods from AutoClosable: close