klyn.io.FileReader.FileReader
constructor
public FileReader(notnull filePath as Path, encoding as String = "utf-8")
Description

Creates a reader on the given file path.

Parameters
ParameterDescription
filePathFile path to read from.
encodingCharset name; auto detects a Unicode BOM, otherwise UTF-8.
Throws
  • FileNotFoundException if the file does not exist.
  • IOException if the path is not a regular file.
  • NullException if filePath is null at runtime; statically null arguments are rejected with TypeError.
Example
try reader = FileReader(Path("notes.txt"), encoding="utf-8"):
    print(reader.read())