Package jminusminus
Class CharReader
java.lang.Object
jminusminus.CharReader
A buffered character reader, which abstracts out differences between platforms, mapping all new
lines to '\n', and also keeps track of line numbers.
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
EOFCH
public static final char EOFCH- See Also:
-
-
Constructor Details
-
CharReader
Constructs a CharReader from a file name.- Parameters:
fileName
- the name of the input file.- Throws:
FileNotFoundException
- if the file is not found.
-
-
Method Details
-
nextChar
Scans and returns the next character.- Returns:
- the character scanned.
- Throws:
IOException
- if an I/O error occurs.
-
line
public int line()Returns the current line number in the source file.- Returns:
- the current line number in the source file.
-
fileName
Returns the file name.- Returns:
- the file name.
-
close
Closes the file.- Throws:
IOException
- if an I/O error occurs.
-