Package org.apache.hc.core5.http.message
Class BasicHeaderValueFormatter
- java.lang.Object
-
- org.apache.hc.core5.http.message.BasicHeaderValueFormatter
-
- All Implemented Interfaces:
HeaderValueFormatter
@Contract(threading=IMMUTABLE) public class BasicHeaderValueFormatter extends java.lang.Object implements HeaderValueFormatter
DefaultHeaderValueFormatter
implementation.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description static BasicHeaderValueFormatter
INSTANCE
private static java.lang.String
SEPARATORS
private static java.lang.String
UNSAFE_CHARS
-
Constructor Summary
Constructors Constructor Description BasicHeaderValueFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
formatElements(CharArrayBuffer buffer, HeaderElement[] elems, boolean quote)
Formats an array of header elements.void
formatHeaderElement(CharArrayBuffer buffer, HeaderElement elem, boolean quote)
Formats one header element.void
formatNameValuePair(CharArrayBuffer buffer, NameValuePair nvp, boolean quote)
Formats one name-value pair, where the value is optional.void
formatParameters(CharArrayBuffer buffer, NameValuePair[] nvps, boolean quote)
Formats the parameters of a header element.(package private) void
formatValue(CharArrayBuffer buffer, java.lang.String value, boolean quote)
(package private) boolean
isSeparator(char ch)
(package private) boolean
isUnsafe(char ch)
-
-
-
Field Detail
-
INSTANCE
public static final BasicHeaderValueFormatter INSTANCE
-
SEPARATORS
private static final java.lang.String SEPARATORS
- See Also:
- Constant Field Values
-
UNSAFE_CHARS
private static final java.lang.String UNSAFE_CHARS
- See Also:
- Constant Field Values
-
-
Method Detail
-
formatElements
public void formatElements(CharArrayBuffer buffer, HeaderElement[] elems, boolean quote)
Description copied from interface:HeaderValueFormatter
Formats an array of header elements.- Specified by:
formatElements
in interfaceHeaderValueFormatter
- Parameters:
buffer
- buffer to write formatted content to.elems
- the header elements to formatquote
-true
to always format with quoted values,false
to use quotes only when necessary
-
formatHeaderElement
public void formatHeaderElement(CharArrayBuffer buffer, HeaderElement elem, boolean quote)
Description copied from interface:HeaderValueFormatter
Formats one header element.- Specified by:
formatHeaderElement
in interfaceHeaderValueFormatter
- Parameters:
buffer
- buffer to write formatted content to.elem
- the header element to formatquote
-true
to always format with quoted values,false
to use quotes only when necessary
-
formatParameters
public void formatParameters(CharArrayBuffer buffer, NameValuePair[] nvps, boolean quote)
Description copied from interface:HeaderValueFormatter
Formats the parameters of a header element. That's a list of name-value pairs, to be separated by semicolons. This method will not generate a leading semicolon.- Specified by:
formatParameters
in interfaceHeaderValueFormatter
- Parameters:
buffer
- buffer to write formatted content to.nvps
- the parameters (name-value pairs) to formatquote
-true
to always format with quoted values,false
to use quotes only when necessary
-
formatNameValuePair
public void formatNameValuePair(CharArrayBuffer buffer, NameValuePair nvp, boolean quote)
Description copied from interface:HeaderValueFormatter
Formats one name-value pair, where the value is optional.- Specified by:
formatNameValuePair
in interfaceHeaderValueFormatter
- Parameters:
buffer
- buffer to write formatted content to.nvp
- the name-value pair to formatquote
-true
to always format with a quoted value,false
to use quotes only when necessary
-
formatValue
void formatValue(CharArrayBuffer buffer, java.lang.String value, boolean quote)
-
isSeparator
boolean isSeparator(char ch)
-
isUnsafe
boolean isUnsafe(char ch)
-
-