public class QuoteUtil extends 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 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 String |
dequote(String str)
Remove quotes from a string, only if the input string start with and end with the same quote character.
|
static void |
escape(StringBuilder buf,
String str) |
static String |
join(Collection<?> objs,
String delim) |
static String |
join(Object[] objs,
String delim) |
static void |
quote(StringBuilder buf,
String str)
Simple quote of a string, escaping where needed.
|
static void |
quoteIfNeeded(StringBuilder buf,
String str,
String delim)
Append into buf the provided string, adding quotes if needed.
|
static Iterator<String> |
splitAt(String str,
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 String |
unescape(String str) |
public static final String ABNF_REQUIRED_QUOTING
public static String dequote(String str)
str
- the string to remove surrounding quotes frompublic static void escape(StringBuilder buf, String str)
public static void quote(StringBuilder buf, String str)
buf
- the StringBuilder to append tostr
- the string to quotepublic static void quoteIfNeeded(StringBuilder buf, String str, 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 Iterator<String> splitAt(String str, String delims)
str
- the input string to split apartdelims
- the delimiter characters to split the string onpublic static String join(Collection<?> objs, String delim)
Copyright © 1995-2015 Webtide. All Rights Reserved.