@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class ExampleCommandLineArgument extends java.lang.Object implements java.io.Serializable
parseExampleCommandLine(java.lang.String)
method regardless of the platform. This
method can be used when needing to parse a command line that was generated
by this class outside of a shell environment, e.g. if the full command line
was read from a file. Special characters that are escaped include |, &,
;, (, ), !, ", ', *, ?, $, and `.Modifier and Type | Method and Description |
---|---|
static ExampleCommandLineArgument |
getCleanArgument(java.lang.String argument)
Return a clean form of the specified argument that can be used directly
on the command line.
|
java.lang.String |
getLocalForm()
Return the form of the argument that is safe to use in the command line
shell of the current operating system platform.
|
java.lang.String |
getRawForm()
Return the original, unquoted raw form of the argument.
|
java.lang.String |
getUnixForm()
Return the form of the argument that is safe to use in a Unix command
line shell.
|
static java.lang.String |
getUnixForm(java.lang.String argument)
Return a clean form of the specified argument that can be used directly
on a Unix command line.
|
java.lang.String |
getWindowsForm()
Return the form of the argument that is safe to use in a Windows command
line shell.
|
static java.lang.String |
getWindowsForm(java.lang.String argument)
Return a clean form of the specified argument that can be used directly
on a Windows command line.
|
static java.util.List<java.lang.String> |
parseExampleCommandLine(java.lang.String exampleCommandLine)
Return a list of raw parameters that were parsed from the specified String.
|
@NotNull public java.lang.String getRawForm()
getCleanArgument(java.lang.String)
method.@NotNull public java.lang.String getUnixForm()
@NotNull public java.lang.String getWindowsForm()
@NotNull public java.lang.String getLocalForm()
@NotNull public static ExampleCommandLineArgument getCleanArgument(@NotNull java.lang.String argument)
argument
- The raw argument to convert into a clean form that can
be used directly on the command line.@NotNull public static java.lang.String getUnixForm(@NotNull java.lang.String argument)
argument
- The raw argument to convert into a clean form that can
be used directly on the Unix command line.@NotNull public static java.lang.String getWindowsForm(@NotNull java.lang.String argument)
argument
- The raw argument to convert into a clean form that can
be used directly on the Windows command line.@NotNull public static java.util.List<java.lang.String> parseExampleCommandLine(@NotNull java.lang.String exampleCommandLine)
getCleanArgument(java.lang.String)
. It perfectly handles any String that was
passed into this method, but it won't behave exactly as any single shell
behaves because they aren't consistent. For instance, it will never
treat \\ as an escape character.exampleCommandLine
- The command line to parse.