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

public Class RFC9110QuotedStringTokenizer

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

An implementation of QuotedStringTokenizer with partial handling of RFC9110 quoted-strings. The deviation from the RFC is that characters are not enforced to be qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text and it is expected that the caller will enforce any character restrictions.

Field Summary

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

Constructor Summary

AccessConstructor and Description
pack-priv
RFC9110QuotedStringTokenizer(String delim, boolean optionalWhiteSpace, boolean returnDelimiters, boolean returnQuotes, boolean embeddedQuotes, boolean escapeOnlyQuote)

Method Summary

Modifier and TypeMethod and Description
protected boolean
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.
private String
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
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
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:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_delimback to summary
private final String _delim
_embeddedQuotesback to summary
private final boolean _embeddedQuotes
_escapeOnlyQuoteback to summary
private final boolean _escapeOnlyQuote
_optionalWhiteSpaceback to summary
private final boolean _optionalWhiteSpace
_returnDelimitersback to summary
private final boolean _returnDelimiters
_returnQuotesback to summary
private final boolean _returnQuotes

Constructor Detail

RFC9110QuotedStringTokenizerback to summary
pack-priv RFC9110QuotedStringTokenizer(String delim, boolean optionalWhiteSpace, boolean returnDelimiters, boolean returnQuotes, boolean embeddedQuotes, boolean escapeOnlyQuote)

Method Detail

isOptionalWhiteSpaceback to summary
protected boolean isOptionalWhiteSpace(char c)
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
quoteIfNeededImplback to summary
private String quoteIfNeededImpl(StringBuilder buf, String str)
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
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

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