Package com.martiansoftware.jsap
Class CommandLineTokenizer
- java.lang.Object
-
- com.martiansoftware.jsap.CommandLineTokenizer
-
public class CommandLineTokenizer extends java.lang.Object
A utility class to parse a command line contained in a single String into an array of argument tokens, much as the JVM (or more accurately, your operating system) does before calling your programs'
public static void main(String[] args)
methods.This class has been developed to parse the command line in the same way that MS Windows 2000 does. Arguments containing spaces should be enclosed in quotes. Quotes that should be in the argument string should be escaped with a preceding backslash ('\') character. Backslash characters that should be in the argument string should also be escaped with a preceding backslash character.
WheneverJSAP.parse(String)
is called, the specified String is tokenized by this class, then forwarded toJSAP.parse(String[])
for further processing.- Author:
- Marty Lamb
- See Also:
JSAP.parse(String)
,JSAP.parse(String[])
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]
tokenize(java.lang.String commandLine)
Parses the specified command line into an array of individual arguments.
-
-
-
Method Detail
-
tokenize
public static java.lang.String[] tokenize(java.lang.String commandLine)
Parses the specified command line into an array of individual arguments. Arguments containing spaces should be enclosed in quotes. Quotes that should be in the argument string should be escaped with a preceding backslash ('\') character. Backslash characters that should be in the argument string should also be escaped with a preceding backslash character.- Parameters:
commandLine
- the command line to parse- Returns:
- an argument array representing the specified command line.
-
-