public class QuoteUtil
extends java.lang.Object
While QuotedStringTokenizer exists in jetty-util, and works great with http header values, using it in websocket-api is undesired.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ABNF_REQUIRED_QUOTING
ABNF from RFC 2616, RFC 822, and RFC 6455 specified characters requiring quoting.
|
Constructor and Description |
---|
QuoteUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
dequote(java.lang.String str)
Remove quotes from a string, only if the input string start with and end with the same quote character.
|
static void |
escape(java.lang.StringBuilder buf,
java.lang.String str) |
static java.lang.String |
join(java.util.Collection<?> objs,
java.lang.String delim) |
static java.lang.String |
join(java.lang.Object[] objs,
java.lang.String delim) |
static void |
quote(java.lang.StringBuilder buf,
java.lang.String str)
Simple quote of a string, escaping where needed.
|
static void |
quoteIfNeeded(java.lang.StringBuilder buf,
java.lang.String str,
java.lang.String delim)
Append into buf the provided string, adding quotes if needed.
|
static java.util.Iterator<java.lang.String> |
splitAt(java.lang.String str,
java.lang.String delims)
Create an iterator of the input string, breaking apart the string at the provided delimiters, removing quotes and triming the parts of the string as
needed.
|
static java.lang.String |
unescape(java.lang.String str) |
public static final java.lang.String ABNF_REQUIRED_QUOTING
public static java.lang.String dequote(java.lang.String str)
str
- the string to remove surrounding quotes frompublic static void escape(java.lang.StringBuilder buf, java.lang.String str)
public static void quote(java.lang.StringBuilder buf, java.lang.String str)
buf
- the StringBuilder to append tostr
- the string to quotepublic static void quoteIfNeeded(java.lang.StringBuilder buf, java.lang.String str, java.lang.String delim)
Quoting is determined if any of the characters in the delim
are found in the input str
.
buf
- the buffer to append tostr
- the string to possibly quotedelim
- the delimiter characters that will trigger automatic quotingpublic static java.util.Iterator<java.lang.String> splitAt(java.lang.String str, java.lang.String delims)
str
- the input string to split apartdelims
- the delimiter characters to split the string onpublic static java.lang.String unescape(java.lang.String str)
public static java.lang.String join(java.lang.Object[] objs, java.lang.String delim)
public static java.lang.String join(java.util.Collection<?> objs, java.lang.String delim)
Copyright © 1995–2023 Webtide. All rights reserved.