Class CommandParser
java.lang.Object
com.ibm.java.diagnostics.utils.commands.CommandParser
Handles command line entries and does extra interpretation, such as handling quoted strings (whilst discarding
quotes themselves and handling escaped characters), recognising redirection to file etc.
NOTE: As of Nov 2011, another copy of this class lives in com.ibm.j9ddr.command. Any changes to this file must be copied across.
-
Constructor Summary
ConstructorDescriptionCommandParser
(String commandLine) CommandParser
(String command, String[] arguments) -
Method Summary
Modifier and TypeMethodDescriptionString[]
Just the command arguments, strips the ">" or ">>" and all strings that follow (i.e. file redirection).Returns a PrintStream, which either writes to a new file or overwrites or appends to an existing one, depending on the command.boolean
-
Constructor Details
-
CommandParser
- Throws:
ParseException
-
CommandParser
- Throws:
ParseException
-
-
Method Details
-
getOriginalLine
-
getCommand
-
isRedirectedToFile
public boolean isRedirectedToFile() -
getArguments
Just the command arguments, strips the ">" or ">>" and all strings that follow (i.e. file redirection).- Returns:
-
getOutputFile
Returns a PrintStream, which either writes to a new file or overwrites or appends to an existing one, depending on the command.- Returns:
- Throws:
IOException
IllegalStateException
- - thrown if the command is not redirected to file. Use isRedirectedToFile() to check.
-