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 Object
      implements HeaderValueFormatter

  Default `HeaderValueFormatter` implementation.
  Since:
    4.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static BasicHeaderValueFormatter` | `INSTANCE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicHeaderValueFormatter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### INSTANCE

          public static final BasicHeaderValueFormatter INSTANCE

  - ### Constructor Detail

    - #### BasicHeaderValueFormatter

          public BasicHeaderValueFormatter()

  - ### 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 interface `HeaderValueFormatter`
      Parameters:
        `buffer` - buffer to write formatted content to.
        `elems` - the header elements to format
        `quote` - `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 interface `HeaderValueFormatter`
      Parameters:
        `buffer` - buffer to write formatted content to.
        `elem` - the header element to format
        `quote` - `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 interface `HeaderValueFormatter`
      Parameters:
        `buffer` - buffer to write formatted content to.
        `nvps` - the parameters (name-value pairs) to format
        `quote` - `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 interface `HeaderValueFormatter`
      Parameters:
        `buffer` - buffer to write formatted content to.
        `nvp` - the name-value pair to format
        `quote` - `true` to always format with a quoted value, `false` to use quotes only when necessary

Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.