public class HeaderValueFormatter extends Object
Description:
| 限定符和类型 | 字段和说明 |
|---|---|
static HeaderValueFormatter |
INSTANCE |
static String |
SEPARATORS
Special characters that can be used as separators in HTTP parameters.
|
static String |
UNSAFE_CHARS
Unsafe special characters that must be escaped using the backslash
character
|
| 构造器和说明 |
|---|
HeaderValueFormatter() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
doFormatValue(CharArrayBuffer buffer,
String value,
boolean quote)
Actually formats the value of a name-value pair.
|
protected int |
estimateNameValuePairLen(NameValue nvp)
Estimates the length of a formatted name-value pair.
|
protected int |
estimateParametersLen(NameValue[] nvps)
Estimates the length of formatted parameters.
|
CharArrayBuffer |
formatNameValuePair(CharArrayBuffer charBuffer,
NameValue nvp,
boolean quote) |
static String |
formatNameValuePair(NameValue nvp,
boolean quote,
HeaderValueFormatter formatter)
Formats a name-value pair.
|
CharArrayBuffer |
formatParameters(CharArrayBuffer charBuffer,
NameValue[] nvps,
boolean quote) |
static String |
formatParameters(NameValue[] nvps,
boolean quote,
HeaderValueFormatter formatter)
Formats a set of parameters.
|
protected boolean |
isSeparator(char ch)
Checks whether a character is a
separator. |
protected boolean |
isUnsafe(char ch)
Checks whether a character is
unsafe. |
public static final HeaderValueFormatter INSTANCE
public static final String SEPARATORS
public static String formatParameters(NameValue[] nvps, boolean quote, HeaderValueFormatter formatter)
nvps - the parameters to formatquote - true to always format with quoted values,
false to use quotes only when necessaryformatter - the formatter to use, or null
for the defaultpublic CharArrayBuffer formatParameters(CharArrayBuffer charBuffer, NameValue[] nvps, boolean quote)
protected int estimateParametersLen(NameValue[] nvps)
nvps - the parameters to format, or nullpublic static String formatNameValuePair(NameValue nvp, boolean quote, HeaderValueFormatter formatter)
nvp - the name-value pair to formatquote - true to always format with a quoted value,
false to use quotes only when necessaryformatter - the formatter to use, or null
for the defaultpublic CharArrayBuffer formatNameValuePair(CharArrayBuffer charBuffer, NameValue nvp, boolean quote)
protected int estimateNameValuePairLen(NameValue nvp)
nvp - the name-value pair to format, or nullprotected void doFormatValue(CharArrayBuffer buffer, String value, boolean quote)
formatNameValuePair.buffer - the buffer to append to, never nullvalue - the value to append, never nullquote - true to always format with quotes,
false to use quotes only when necessaryprotected boolean isSeparator(char ch)
separator.ch - the character to checktrue if the character is a separator,
false otherwiseprotected boolean isUnsafe(char ch)
unsafe.ch - the character to checktrue if the character is unsafe,
false otherwiseCopyright © 2019. All rights reserved.