TextReader

The TextReader object, returned by the openTextReader() function, allows to open, parse, read and close a text file. (See: openTextReader().)

Methods

The following table describes the methods of the TextReader object.

Method Description

close()

Closes the stream and releases resources.

open(inStream, inEncoding)

Creates a reader from an input stream.
Parameters:

  • inStream: the input stream to read

  • inEncoding: the encoding to use when reading the file

open(inFileName, inEncoding)

Creates a reader on the specified file.
Parameters:

  • inFilename: the path of the file to read

  • inEncoding: the encoding to use when reading the file

parseCharset(inEncoding)

Returns a character set (Charset). Character sets are used to convert a binary data file into readable text.
Parameters:

  • inEncoding: the encoding to use (e.g. ISO-8859-1, UTF-8)

read()

Reads and returns the next character, or -1 if the end of the stream has been reached.

readLine()

Reads and returns the next line, or null if the end of the stream has been reached.

skip(offset)

Skips the specified number of characters.
Parameters:

  • offset: the number of characters to skip