Top Inners Fields Constructors Methods
org.eclipse.jetty.util

public Class LegacyQuotedStringTokenizer

extends Object
implements QuotedStringTokenizer
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.QuotedStringTokenizer
Imports
java.io.IOException, java.util.Arrays, .Iterator, .NoSuchElementException, .StringTokenizer

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final String
private final boolean
private final boolean
private final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
LegacyQuotedStringTokenizer(String delim, boolean returnDelimiters, boolean returnQuotes, boolean singleQuotes)

Method Summary

Modifier and TypeMethod and Description
public boolean
public void
quote(Appendable
The Appendable to append the quoted and escaped string into.
buffer
,
String
The String to quote.
input
)

Implements org.eclipse.jetty.util.QuotedStringTokenizer.quote.

Quote a string into an Appendable, escaping any characters that need to be escaped.

public String
quoteIfNeeded(String
The string to quote.
s
)

Implements org.eclipse.jetty.util.QuotedStringTokenizer.quoteIfNeeded.

Quote a string.

public void
quoteIfNeeded(StringBuilder
the buffer to append to
buf
,
String
the string to possibly quote
str
)

Implements org.eclipse.jetty.util.QuotedStringTokenizer.quoteIfNeeded.

Append into buf the provided string, adding quotes if needed.

public Iterator<String>
tokenize(String
The string to be tokenized
string
)

Implements org.eclipse.jetty.util.QuotedStringTokenizer.tokenize.

Tokenize the passed string into an Iterator of tokens split from the string by delimiters.

public String
unquote(String
The string to unquote.
s
)

Implements org.eclipse.jetty.util.QuotedStringTokenizer.unquote.

Unquote a string and expand any escaped characters

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_delimback to summary
private final String _delim
_returnDelimitersback to summary
private final boolean _returnDelimiters
_returnQuotesback to summary
private final boolean _returnQuotes
_singleQuotesback to summary
private final boolean _singleQuotes

Constructor Detail

LegacyQuotedStringTokenizerback to summary
pack-priv LegacyQuotedStringTokenizer(String delim, boolean returnDelimiters, boolean returnQuotes, boolean singleQuotes)

Method Detail

needsQuotingback to summary
public boolean needsQuoting(char c)

Implements org.eclipse.jetty.util.QuotedStringTokenizer.needsQuoting.

Parameters
c:char

Doc from org.eclipse.jetty.util.QuotedStringTokenizer.needsQuoting.

A character

Returns:boolean

Doc from org.eclipse.jetty.util.QuotedStringTokenizer.needsQuoting.

True if a string containing the character should be quoted.

Annotations
@Override
quoteback to summary
public void quote(Appendable buffer, String input)

Implements org.eclipse.jetty.util.QuotedStringTokenizer.quote.

Doc from org.eclipse.jetty.util.QuotedStringTokenizer.quote.

Quote a string into an Appendable, escaping any characters that need to be escaped.

Parameters
buffer:Appendable

The Appendable to append the quoted and escaped string into.

input:String

The String to quote.

Annotations
@Override
quoteIfNeededback to summary
public String quoteIfNeeded(String s)

Implements org.eclipse.jetty.util.QuotedStringTokenizer.quoteIfNeeded.

Doc from org.eclipse.jetty.util.QuotedStringTokenizer.quoteIfNeeded.

Quote a string. The string is quoted only if quoting is required due to embedded delimiters, quote characters or the empty string.

Parameters
s:String

The string to quote.

Returns:String

quoted string

Annotations
@Override
quoteIfNeededback to summary
public void quoteIfNeeded(StringBuilder buf, String str)

Implements org.eclipse.jetty.util.QuotedStringTokenizer.quoteIfNeeded.

Doc from org.eclipse.jetty.util.QuotedStringTokenizer.quoteIfNeeded.

Append into buf the provided string, adding quotes if needed.

Quoting is determined if any of the characters in the delim are found in the input str.

Parameters
buf:StringBuilder

the buffer to append to

str:String

the string to possibly quote

Annotations
@Override
tokenizeback to summary
public Iterator<String> tokenize(String string)

Implements org.eclipse.jetty.util.QuotedStringTokenizer.tokenize.

Doc from org.eclipse.jetty.util.QuotedStringTokenizer.tokenize.

Tokenize the passed string into an Iterator of tokens split from the string by delimiters. Tokenization is done as the iterator is advanced.

Parameters
string:String

The string to be tokenized

Returns:Iterator<String>

An iterator of token strings.

Annotations
@Override
unquoteback to summary
public String unquote(String s)

Implements org.eclipse.jetty.util.QuotedStringTokenizer.unquote.

Doc from org.eclipse.jetty.util.QuotedStringTokenizer.unquote.

Unquote a string and expand any escaped characters

Parameters
s:String

The string to unquote.

Returns:String

unquoted string with escaped characters expanded.

Annotations
@Override
org.eclipse.jetty.util back to summary

private Class LegacyQuotedStringTokenizer.LegacyTokenizer

extends StringTokenizer
Class Inheritance

Field Summary

Modifier and TypeField and Description
private boolean
private int
private final String
private final StringBuffer
private static final char[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
public boolean
hasMoreTokens()

Overrides java.util.StringTokenizer.hasMoreTokens.

Tests if there are more tokens available from this tokenizer's string.

private static boolean
isValidEscaping(char c)

Check that char c (which is preceded by a backslash) is a valid escape sequence.

public static boolean
needsQuoting(char c, String delim)

public String
nextToken()

Overrides java.util.StringTokenizer.nextToken.

Returns the next token from this string tokenizer.

public String
nextToken(String
the new delimiters.
delim
)

Overrides java.util.StringTokenizer.nextToken.

Returns the next token in this string tokenizer's string.

public static String

Returns:

quoted string
quote
(String
The string to quote.
s
)

Quote a string.

public static void
quote(Appendable
The Appendable
buffer
,
String
The String to quote.
input
)

Quote a string into an Appendable.

public static String

Returns:

quoted string
quoteIfNeeded
(String
The string to quote.
s
,
String
the delimiter to use to quote the string
delim
)

Quote a string.

public static void
quoteIfNeeded(StringBuilder
the buffer to append to
buf
,
String
the string to possibly quote
str
,
String
the delimiter characters that will trigger automatic quoting
delim
)

Append into buf the provided string, adding quotes if needed.

public static String
public static String

Returns:

quoted string
unquote
(String
The string to unquote.
s
,
boolean
true if unquoting should be lenient to escaped content, leaving some alone, false if string unescaping
lenient
)

Unquote a string.

Inherited from java.util.StringTokenizer:
hasMoreElementsnextElement

Field Detail

_hasTokenback to summary
private boolean _hasToken
_iback to summary
private int _i
_stringback to summary
private final String _string
_tokenback to summary
private final StringBuffer _token
escapesback to summary
private static final char[] escapes

Constructor Detail

LegacyTokenizerback to summary
public LegacyTokenizer(String str)

Method Detail

countTokensback to summary
public int countTokens()

Overrides java.util.StringTokenizer.countTokens.

Not implemented.

Returns:int

Doc from java.util.StringTokenizer.countTokens.

the number of tokens remaining in the string using the current delimiter set.

Annotations
@Override
hasMoreTokensback to summary
public boolean hasMoreTokens()

Overrides java.util.StringTokenizer.hasMoreTokens.

Doc from java.util.StringTokenizer.hasMoreTokens.

Tests if there are more tokens available from this tokenizer's string. If this method returns true, then a subsequent call to nextToken with no argument will successfully return a token.

Returns:boolean

true if and only if there is at least one token in the string after the current position; false otherwise.

Annotations
@Override
isValidEscapingback to summary
private static boolean isValidEscaping(char c)

Check that char c (which is preceded by a backslash) is a valid escape sequence.

needsQuotingback to summary
public static boolean needsQuoting(char c, String delim)
nextTokenback to summary
public String nextToken() throws NoSuchElementException

Overrides java.util.StringTokenizer.nextToken.

Doc from java.util.StringTokenizer.nextToken.

Returns the next token from this string tokenizer.

Returns:String

the next token from this string tokenizer.

Annotations
@Override
Exceptions
NoSuchElementException:
if there are no more tokens in this tokenizer's string.
nextTokenback to summary
public String nextToken(String delim) throws NoSuchElementException

Overrides java.util.StringTokenizer.nextToken.

Doc from java.util.StringTokenizer.nextToken.

Returns the next token in this string tokenizer's string. First, the set of characters considered to be delimiters by this StringTokenizer object is changed to be the characters in the string delim. Then the next token in the string after the current position is returned. The current position is advanced beyond the recognized token. The new delimiter set remains the default after this call.

Parameters
delim:String

the new delimiters.

Returns:String

the next token, after switching to the new delimiter set.

Annotations
@Override
Exceptions
NoSuchElementException:
if there are no more tokens in this tokenizer's string.
quoteback to summary
public static String quote(String s)

Quote a string. The string is quoted only if quoting is required due to embedded delimiters, quote characters or the empty string.

Parameters
s:String

The string to quote.

Returns:String

quoted string

quoteback to summary
public static void quote(Appendable buffer, String input)

Quote a string into an Appendable. The characters ", \, \n, \r, \t, \f and \b are escaped

Parameters
buffer:Appendable

The Appendable

input:String

The String to quote.

quoteIfNeededback to summary
public static String quoteIfNeeded(String s, String delim)

Quote a string. The string is quoted only if quoting is required due to embedded delimiters, quote characters or the empty string.

Parameters
s:String

The string to quote.

delim:String

the delimiter to use to quote the string

Returns:String

quoted string

quoteIfNeededback to summary
public static void quoteIfNeeded(StringBuilder buf, String str, String delim)

Append into buf the provided string, adding quotes if needed.

Quoting is determined if any of the characters in the delim are found in the input str.

Parameters
buf:StringBuilder

the buffer to append to

str:String

the string to possibly quote

delim:String

the delimiter characters that will trigger automatic quoting

unquoteback to summary
public static String unquote(String s)
unquoteback to summary
public static String unquote(String s, boolean lenient)

Unquote a string.

Parameters
s:String

The string to unquote.

lenient:boolean

true if unquoting should be lenient to escaped content, leaving some alone, false if string unescaping

Returns:String

quoted string