All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----cs005.io.FileLineReader
This will create a new FileLineReader with the given path.
This returns the number of the current line that the reader is reading from.
This method returns a single character of information read from the file.
This is another version of the read method.
This returns the actual line of text that the reader is currently on.
This method sets the current line number to the supplied parameter.
public FileLineReader(String path)
This will create a new FileLineReader with the given path. If the file is not found, an InvalidFileException will be thrown.
public int getLineNumber()
This returns the number of the current line that the reader is reading from.
public String readLine() throws InvalidFileException
This returns the actual line of text that the reader is currently on. Once you call this method, the reader moves on to the next line of text, so it will never return the same line twice.
public void setLineNumber(int lineNumber)
This method sets the current line number to the supplied parameter.
public int read() throws InvalidFileException
This method returns a single character of information read from the file. Like readLine, once you call this method, the reader moves on to the next line. This method is usually used inside of while loops for ease of separating into tokens manually.
public int read(char cbuffer[], int offset, int length) throws InvalidFileException
This is another version of the read method. This will read a section of the file from the supplied offset for the supplied length. The text is put into the character array parameter.
All Packages Class Hierarchy This Package Previous Next Index