FileReader
classin packageklyn.io
public class FileReader implements TextReader
FileReader
All Implemented Interfaces: TextReader

Text reader backed by one file.

import klyn.io

try reader = FileReader("README.md"):
    print(reader.readLine())
Constructors
Modifier and Type Member Description
public FileReader
FileReader(notnull filePath as Path, encoding as String = "utf-8")
Creates a reader on the given file path.
public FileReader
FileReader(notnull filename as String, encoding as String = "utf-8")
Creates a reader on the given file name.
Methods
Modifier and Type Member Description
public close
close() as Void throws IOException
Closes the reader.
public read
read() as String throws IOException
Reads all remaining text from the current reader position.
public readAllText
readAllText() as String throws IOException
Reads all remaining text from the current reader position.
public readLine
readLine() as String throws IOException
Reads one line from the current reader position.
public readLines
readLines() as ArrayList<String> throws IOException
Reads all remaining lines from the current reader position.
public static readPrefix
readPrefix(filename as String, maxBytes as Long) as String throws IOException
Reads at most the first maxBytes bytes from a text file.
Inherited Methods
methodInherited Methods from AutoClosable: close