- java.lang.Object
-
- com.ibm.jvm.dtfjview.tools.Tool
-
- com.ibm.jvm.dtfjview.tools.impl.CmdFileTool
-
-
Field Summary
Fields Modifier and Type Field Description static String
ARGUMENT_DESCRIPTION
static String[]
AS_COMMENT_INDICATORS
static String
COMMAND
static String
HELP_DESCRIPTION
static String
USAGE
-
Constructor Summary
Constructors Constructor Description CmdFileTool(String charset)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(String command, String[] args)
Determines if a command is accepted by the current tool.String
getArgumentDescription()
To gets the tool's argument description.String
getCommandName()
To gets the tool's command name.String
getHelpDescription()
To gets the tool's help description.static List<String>
parseCmdFile(File cmdFile, String charset)
To parse a command file.void
printDetailedHelp(PrintStream out)
To print the detailed help message.void
process(String command, String[] args, PrintStream out)
Processes the command.
-
-
-
Field Detail
-
AS_COMMENT_INDICATORS
public static final String[] AS_COMMENT_INDICATORS
-
COMMAND
public static final String COMMAND
- See Also:
- Constant Field Values
-
ARGUMENT_DESCRIPTION
public static final String ARGUMENT_DESCRIPTION
- See Also:
- Constant Field Values
-
HELP_DESCRIPTION
public static final String HELP_DESCRIPTION
- See Also:
- Constant Field Values
-
USAGE
public static final String USAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmdFileTool
public CmdFileTool(String charset)
-
-
Method Detail
-
parseCmdFile
public static List<String> parseCmdFile(File cmdFile, String charset) throws UnsupportedEncodingException, IOException
To parse a command file.- Parameters:
cmdFile
- The command file.charset
- If not null, the charset is used to decode the strings in the file.- Returns:
- The list of commands.
- Throws:
UnsupportedEncodingException
IOException
-
accept
public boolean accept(String command, String[] args)
Determines if a command is accepted by the current tool.- Parameters:
command
- The commandargs
- The arguments taken by the command.- Returns:
true
if this is the correct tool for this command;false
otherwise.
-
process
public void process(String command, String[] args, PrintStream out) throws CommandException
Processes the command.- Parameters:
command
- The command to be processed.args
- The arguments taken by the command.out
- The output channel.- Throws:
CommandException
-
getCommandName
public String getCommandName()
To gets the tool's command name.- Returns:
- The tool's command name.
-
getArgumentDescription
public String getArgumentDescription()
To gets the tool's argument description.- Returns:
- The tool's argument description.
-
getHelpDescription
public String getHelpDescription()
To gets the tool's help description.- Returns:
- The tool's help description.
-
printDetailedHelp
public void printDetailedHelp(PrintStream out)
To print the detailed help message.
-
-