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

Creates a reader on the given file name.

Parameters
ParameterDescription
filenameFile 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 filename is null at runtime; statically null arguments are rejected with TypeError.
Example
try reader = FileReader("notes.txt", encoding="utf-8"):
    print(reader.read())