Package hudson.util
Class QuotedStringTokenizer
java.lang.Object
java.util.StringTokenizer
hudson.util.QuotedStringTokenizer
- All Implemented Interfaces:
Enumeration<Object>
StringTokenizer with Quoting support.
This class is a copy of the java.util.StringTokenizer API and
the behaviour is the same, except that single and double quoted
string values are recognized.
Delimiters within quotes are not considered delimiters.
Quotes can be escaped with '\'.
- Author:
- Greg Wilkins (gregw)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionQuotedStringTokenizer(String str, String delim) QuotedStringTokenizer(String str, String delim, boolean returnDelimiters) QuotedStringTokenizer(String str, String delim, boolean returnDelimiters, boolean returnQuotes) -
Method Summary
Modifier and TypeMethodDescriptionstatic byteconvertHexDigit(byte b) intNot implemented.booleanbooleanbooleanbooleanstatic StringQuote a string.static voidquote(StringBuffer buf, String s) Quote a string into a StringBuffer.static StringQuote a string.voidsetDouble(boolean d) voidsetSingle(boolean single) String[]toArray()static String[]static String[]static StringUnquote a string.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Enumeration
asIterator
-
Constructor Details
-
QuotedStringTokenizer
public QuotedStringTokenizer(String str, String delim, boolean returnDelimiters, boolean returnQuotes) - Parameters:
str- String to tokenize.delim- List of delimiter characters as string. Can be null, to default to ' \t\n\r'returnDelimiters- If true,nextToken()will include the delimiters, not just tokenized tokens.returnQuotes- If true,nextToken()will include the quotation characters when they are present.
-
QuotedStringTokenizer
-
QuotedStringTokenizer
-
QuotedStringTokenizer
-
-
Method Details
-
tokenize
-
tokenize
-
toArray
-
hasMoreTokens
public boolean hasMoreTokens()- Overrides:
hasMoreTokensin classStringTokenizer
-
nextToken
- Overrides:
nextTokenin classStringTokenizer- Throws:
NoSuchElementException
-
nextToken
- Overrides:
nextTokenin classStringTokenizer- Throws:
NoSuchElementException
-
hasMoreElements
public boolean hasMoreElements()- Specified by:
hasMoreElementsin interfaceEnumeration<Object>- Overrides:
hasMoreElementsin classStringTokenizer
-
nextElement
- Specified by:
nextElementin interfaceEnumeration<Object>- Overrides:
nextElementin classStringTokenizer- Throws:
NoSuchElementException
-
countTokens
public int countTokens()Not implemented.- Overrides:
countTokensin classStringTokenizer
-
quote
Quote a string. The string is quoted only if quoting is required due to embedded delimiters, quote characters or the empty string.- Parameters:
s- The string to quote.- Returns:
- quoted string
-
quote
Quote a string. The string is quoted only if quoting is required due to embedded delimiters, quote characters or the empty string.- Parameters:
s- The string to quote.- Returns:
- quoted string
-
quote
Quote a string into a StringBuffer. The characters ", \, \n, \r, \t, \f and \b are escaped- Parameters:
buf- The StringBuffers- The String to quote.
-
unquote
Unquote a string.- Parameters:
s- The string to unquote.- Returns:
- quoted string
-
getDouble
public boolean getDouble()- Returns:
- handle double quotes if true
-
setDouble
public void setDouble(boolean d) - Parameters:
d- handle double quotes if true
-
getSingle
public boolean getSingle()- Returns:
- handle single quotes if true
-
setSingle
public void setSingle(boolean single) - Parameters:
single- handle single quotes if true
-
convertHexDigit
public static byte convertHexDigit(byte b) - Parameters:
b- An ASCII encoded character 0-9 a-f A-F- Returns:
- The byte value of the character 0-16.
-