com.microsoft.tfs.core.externaltools
Class WindowsStyleArgumentTokenizer

java.lang.Object
  extended by com.microsoft.tfs.core.externaltools.WindowsStyleArgumentTokenizer

public abstract class WindowsStyleArgumentTokenizer
extends java.lang.Object

Methods for tokenizing string that contain arguments to external tools in a style similar to TFS on Windows.

Since:
TEE-SDK-10.1
Thread-safety:
immutable

Constructor Summary
WindowsStyleArgumentTokenizer()
           
 
Method Summary
static java.lang.String getRawFirstToken(java.lang.String arguments)
          This is a specialized hack for UI code that deals with command strings.
static java.lang.String[] tokenizeArguments(java.lang.String arguments)
           Tokenizes the argument string into strings to pass to exec in "windows style" -- anything inside paired double quotes is grouped, you may escape double-quotes only inside double-quotes by doubling them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindowsStyleArgumentTokenizer

public WindowsStyleArgumentTokenizer()
Method Detail

getRawFirstToken

public static java.lang.String getRawFirstToken(java.lang.String arguments)
This is a specialized hack for UI code that deals with command strings. It's not very useful otherwise. It gets the raw string that is the first token, up until the first whitespace after the token. Includes leading whitespace. More precisely, it's the entire start of the given string that makes up the first token.

Parameters:
arguments - the arguments to parse
Returns:
the first token in the string, including leading whitespace and all quote and escaped characters

tokenizeArguments

public static java.lang.String[] tokenizeArguments(java.lang.String arguments)
                                            throws ExternalToolException

Tokenizes the argument string into strings to pass to exec in "windows style" -- anything inside paired double quotes is grouped, you may escape double-quotes only inside double-quotes by doubling them. (Confusing, huh?)

That is:

Parameters:
arguments - the arguments to tokenize (must not be null)
Returns:
a string array containing the grouped arguments
Throws:
ExternalToolException - if the argument string cannot be parsed


© 2015 Microsoft. All rights reserved.