Top Description Fields Constructors Methods
org.apache.hc.core5.http.message

public Class BasicHeaderValueFormatter

extends Object
implements HeaderValueFormatter
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.message.HeaderValueFormatter
Annotations
@Contract
threading:IMMUTABLE
Imports
org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.http.HeaderElement, .NameValuePair, org.apache.hc.core5.util.Args, .CharArrayBuffer

Default org.apache.hc.core5.http.message.HeaderValueFormatter implementation.
Since
4.0

Field Summary

Modifier and TypeField and Description
public static final BasicHeaderValueFormatter
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
formatElements(final CharArrayBuffer
buffer to write formatted content to.
buffer
,
final HeaderElement[]
the header elements to format
elems
,
final boolean
true to always format with quoted values, false to use quotes only when necessary
quote
)

Implements org.apache.hc.core5.http.message.HeaderValueFormatter.formatElements.

Formats an array of header elements.
public void
formatHeaderElement(final CharArrayBuffer
buffer to write formatted content to.
buffer
,
final HeaderElement
the header element to format
elem
,
final boolean
true to always format with quoted values, false to use quotes only when necessary
quote
)

Implements org.apache.hc.core5.http.message.HeaderValueFormatter.formatHeaderElement.

Formats one header element.
public void
formatNameValuePair(final CharArrayBuffer
buffer to write formatted content to.
buffer
,
final NameValuePair
the name-value pair to format
nvp
,
final boolean
true to always format with a quoted value, false to use quotes only when necessary
quote
)

Implements org.apache.hc.core5.http.message.HeaderValueFormatter.formatNameValuePair.

Formats one name-value pair, where the value is optional.
public void
formatParameters(final CharArrayBuffer
buffer to write formatted content to.
buffer
,
final NameValuePair[]
the parameters (name-value pairs) to format
nvps
,
final boolean
true to always format with quoted values, false to use quotes only when necessary
quote
)

Implements org.apache.hc.core5.http.message.HeaderValueFormatter.formatParameters.

Formats the parameters of a header element.
pack-priv void
formatValue(final CharArrayBuffer buffer, final String value, final boolean quote)

pack-priv boolean
isSeparator(final char ch)

pack-priv boolean
isUnsafe(final char ch)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final BasicHeaderValueFormatter INSTANCE
SEPARATORSback to summary
private static final String SEPARATORS
UNSAFE_CHARSback to summary
private static final String UNSAFE_CHARS

Constructor Detail

BasicHeaderValueFormatterback to summary
public BasicHeaderValueFormatter()

Method Detail

formatElementsback to summary
public void formatElements(final CharArrayBuffer buffer, final HeaderElement[] elems, final boolean quote)

Implements org.apache.hc.core5.http.message.HeaderValueFormatter.formatElements.

Doc from org.apache.hc.core5.http.message.HeaderValueFormatter.formatElements.

Formats an array of header elements.

Parameters
buffer:CharArrayBuffer

buffer to write formatted content to.

elems:HeaderElement[]

the header elements to format

quote:boolean

true to always format with quoted values, false to use quotes only when necessary

Annotations
@Override
formatHeaderElementback to summary
public void formatHeaderElement(final CharArrayBuffer buffer, final HeaderElement elem, final boolean quote)

Implements org.apache.hc.core5.http.message.HeaderValueFormatter.formatHeaderElement.

Doc from org.apache.hc.core5.http.message.HeaderValueFormatter.formatHeaderElement.

Formats one header element.

Parameters
buffer:CharArrayBuffer

buffer to write formatted content to.

elem:HeaderElement

the header element to format

quote:boolean

true to always format with quoted values, false to use quotes only when necessary

Annotations
@Override
formatNameValuePairback to summary
public void formatNameValuePair(final CharArrayBuffer buffer, final NameValuePair nvp, final boolean quote)

Implements org.apache.hc.core5.http.message.HeaderValueFormatter.formatNameValuePair.

Doc from org.apache.hc.core5.http.message.HeaderValueFormatter.formatNameValuePair.

Formats one name-value pair, where the value is optional.

Parameters
buffer:CharArrayBuffer

buffer to write formatted content to.

nvp:NameValuePair

the name-value pair to format

quote:boolean

true to always format with a quoted value, false to use quotes only when necessary

Annotations
@Override
formatParametersback to summary
public void formatParameters(final CharArrayBuffer buffer, final NameValuePair[] nvps, final boolean quote)

Implements org.apache.hc.core5.http.message.HeaderValueFormatter.formatParameters.

Doc from org.apache.hc.core5.http.message.HeaderValueFormatter.formatParameters.

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.

Parameters
buffer:CharArrayBuffer

buffer to write formatted content to.

nvps:NameValuePair[]

the parameters (name-value pairs) to format

quote:boolean

true to always format with quoted values, false to use quotes only when necessary

Annotations
@Override
formatValueback to summary
pack-priv void formatValue(final CharArrayBuffer buffer, final String value, final boolean quote)
isSeparatorback to summary
pack-priv boolean isSeparator(final char ch)
isUnsafeback to summary
pack-priv boolean isUnsafe(final char ch)