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
DefaultHeaderValueFormatterimplementation.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description static BasicHeaderValueFormatterINSTANCEprivate static java.lang.StringSEPARATORSprivate static java.lang.StringUNSAFE_CHARS
-
Constructor Summary
Constructors Constructor Description BasicHeaderValueFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidformatElements(CharArrayBuffer buffer, HeaderElement[] elems, boolean quote)Formats an array of header elements.voidformatHeaderElement(CharArrayBuffer buffer, HeaderElement elem, boolean quote)Formats one header element.voidformatNameValuePair(CharArrayBuffer buffer, NameValuePair nvp, boolean quote)Formats one name-value pair, where the value is optional.voidformatParameters(CharArrayBuffer buffer, NameValuePair[] nvps, boolean quote)Formats the parameters of a header element.(package private) voidformatValue(CharArrayBuffer buffer, java.lang.String value, boolean quote)(package private) booleanisSeparator(char ch)(package private) booleanisUnsafe(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:HeaderValueFormatterFormats an array of header elements.- Specified by:
formatElementsin interfaceHeaderValueFormatter- Parameters:
buffer- buffer to write formatted content to.elems- the header elements to formatquote-trueto always format with quoted values,falseto use quotes only when necessary
-
formatHeaderElement
public void formatHeaderElement(CharArrayBuffer buffer, HeaderElement elem, boolean quote)
Description copied from interface:HeaderValueFormatterFormats one header element.- Specified by:
formatHeaderElementin interfaceHeaderValueFormatter- Parameters:
buffer- buffer to write formatted content to.elem- the header element to formatquote-trueto always format with quoted values,falseto use quotes only when necessary
-
formatParameters
public void formatParameters(CharArrayBuffer buffer, NameValuePair[] nvps, boolean quote)
Description copied from interface:HeaderValueFormatterFormats 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:
formatParametersin interfaceHeaderValueFormatter- Parameters:
buffer- buffer to write formatted content to.nvps- the parameters (name-value pairs) to formatquote-trueto always format with quoted values,falseto use quotes only when necessary
-
formatNameValuePair
public void formatNameValuePair(CharArrayBuffer buffer, NameValuePair nvp, boolean quote)
Description copied from interface:HeaderValueFormatterFormats one name-value pair, where the value is optional.- Specified by:
formatNameValuePairin interfaceHeaderValueFormatter- Parameters:
buffer- buffer to write formatted content to.nvp- the name-value pair to formatquote-trueto always format with a quoted value,falseto 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)
-
-