Class io::TextFile

Inherits TextStream

The TextFile class represents an open encoded text file as a stream. It allows accessing the contents of an ordinary binary file as a 16-bit Unicode stream.

class TextFile(path as Str[, encoding as Encoding], ... as Constant)
Open an encoded text file. If the encoding is not specified, the encoding will be DefaultEncoding. The rest of the arguments are options. All the options for io::File are supported. Additionally encodings::Strict or encodings::Unstrict may be specified (Strict is the default). Example:
var f = TextFile("file.txt", Utf8)
var s = f.readLn()
f.close()

All Stream operations are supported for TextFile objects. See the descriptions of Stream and TextStream for details.