org.stanwood.media.actions.command
Class ExecParseUtils

java.lang.Object
  extended by org.stanwood.media.actions.command.ExecParseUtils

public final class ExecParseUtils
extends java.lang.Object

Used to parse command line parameters


Field Summary
static java.lang.String QUOTE_CHAR
          The quote char
static java.lang.String WHITESPACE
          The whitespace char
 
Method Summary
protected static boolean isDoubleQuoted(java.lang.String input)
          Tests if the input is enclosed within a double-QUOTE_CHAR string
protected static boolean isSingleQuoted(java.lang.String input)
          Tests if the input is enclosed within QUOTE_CHAR characters
static java.util.List<java.lang.String> splitToWhiteSpaceSeparatedTokens(java.lang.String input)
          Splits the input line string by WHITESPACE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHITESPACE

public static final java.lang.String WHITESPACE
The whitespace char

See Also:
Constant Field Values

QUOTE_CHAR

public static final java.lang.String QUOTE_CHAR
The quote char

See Also:
Constant Field Values
Method Detail

splitToWhiteSpaceSeparatedTokens

public static java.util.List<java.lang.String> splitToWhiteSpaceSeparatedTokens(java.lang.String input)
Splits the input line string by WHITESPACE. Supports quoting the white-spaces with a QUOTE_CHAR. A quote itself can also be enclosed within #QUOTE_CHAR#QUOTE_CHAR. More than two double-quotes in a sequence is not allowed. Nested quotes are not allowed.
E.g. The string "arg 1" arg2 will return the tokens arg 1, arg2
The string ""arg 1"" "arg2" arg 3 will return the tokens "arg 1" , arg2,arg and 3

Parameters:
input - the input to split.
Returns:
a not-null list of tokens

isSingleQuoted

protected static boolean isSingleQuoted(java.lang.String input)
Tests if the input is enclosed within QUOTE_CHAR characters

Parameters:
input - a not null String
Returns:
true if the regular expression is matched

isDoubleQuoted

protected static boolean isDoubleQuoted(java.lang.String input)
Tests if the input is enclosed within a double-QUOTE_CHAR string

Parameters:
input - a not null String
Returns:
true if the regular expression is matched