Interface QuotedStringTokenizer
- All Known Implementing Classes:
LegacyQuotedStringTokenizer, RFC9110QuotedStringTokenizer
public interface QuotedStringTokenizer
A Tokenizer that splits a string into parts, allowing for quotes.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final QuotedStringTokenizerA QuotedStringTokenizer for comma separated values with optional white space. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()static booleanbooleanneedsQuoting(char c) voidquote(Appendable buffer, String input) Quote a string into an Appendable, escaping any characters that need to be escaped.default StringQuote a string.Quote a string.voidquoteIfNeeded(StringBuilder buf, String str) Append into buf the provided string, adding quotes if needed.Tokenize the passed string into anIteratorof tokens split from the string by delimiters.Unquote a string and expand any escaped characters
-
Field Details
-
CSV
A QuotedStringTokenizer for comma separated values with optional white space.
-
-
Method Details
-
builder
- Returns:
- A Builder for a
QuotedStringTokenizer.
-
isQuoted
- Parameters:
s- The string to test- Returns:
- True if the string is quoted.
-
quote
-
quote
Quote a string into an Appendable, escaping any characters that need to be escaped.- Parameters:
buffer- The Appendable to append the quoted and escaped string into.input- The String to quote.
-
unquote
-
tokenize
-
needsQuoting
boolean needsQuoting(char c) - Parameters:
c- A character- Returns:
- True if a string containing the character should be quoted.
-
quoteIfNeeded
-
quoteIfNeeded
Append into buf the provided string, adding quotes if needed.Quoting is determined if any of the characters in the
delimare found in the inputstr.- Parameters:
buf- the buffer to append tostr- the string to possibly quote
-