Module openj9.dtfj

Class CommandParser


  • public class CommandParser
    extends Object
    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.
    • Method Detail

      • getOriginalLine

        public String getOriginalLine()
      • getCommand

        public String getCommand()
      • isRedirectedToFile

        public boolean isRedirectedToFile()
      • getArguments

        public String[] getArguments()
        Just the command arguments, strips the ">" or ">>" and all strings that follow (i.e. file redirection).
        Returns:
      • getOutputFile

        public PrintStream getOutputFile()
                                  throws IOException
        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.