public class InputFileParser
extends java.lang.Object
CommandHandler with
clean commands. Can read from an input file or standard in (if no file is provided).Note: If a user input a "" from standard in, the program will exit. I haven't figured out how to fix and let the program exit when an EOF is return from command line.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
fileIsOpen
Whether an input file is open
|
protected java.io.BufferedReader |
inputFile
Reader holding the input file
|
| Constructor and Description |
|---|
InputFileParser()
Create an instance that reads from standard in.
|
| Modifier and Type | Method and Description |
|---|---|
void |
closeFile()
Closes currently open file.
|
java.util.List<java.lang.String> |
getCommands()
From the open input file, read in the next command.
|
void |
openFile(java.lang.String filename)
Open an input file
|
protected java.lang.String |
readLine()
Gets a complete, nonempty line out of the input stream.
|
protected java.io.BufferedReader inputFile
protected boolean fileIsOpen
public InputFileParser()
public void openFile(java.lang.String filename)
filename - File to be read as inputpublic void closeFile()
public java.util.List<java.lang.String> getCommands()
protected java.lang.String readLine()