org.apache.hc.core5.http.message

## Interface HeaderValueFormatter

- All Known Implementing Classes:
    BasicHeaderValueFormatter

      public interface HeaderValueFormatter

  Interface for formatting elements of a header value. Instances of this interface are expected to be stateless and thread-safe.
  Since:
    4.0

- - ### Method Summary

    All Methods Instance Methods Abstract 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.

- - ### Method Detail

    - #### formatElements

          void formatElements(CharArrayBuffer buffer,
                              HeaderElement[] elems,
                              boolean quote)

      Formats an array of header elements.
      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

          void formatHeaderElement(CharArrayBuffer buffer,
                                   HeaderElement elem,
                                   boolean quote)

      Formats one header element.
      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

          void formatParameters(CharArrayBuffer buffer,
                                NameValuePair[] nvps,
                                boolean quote)

      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` - 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

          void formatNameValuePair(CharArrayBuffer buffer,
                                   NameValuePair nvp,
                                   boolean quote)

      Formats one name-value pair, where the value is optional.
      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–2021 The Apache Software Foundation. All rights reserved.