Enum ContentCoding

java.lang.Object
java.lang.Enum<ContentCoding>
org.apache.hc.client5.http.entity.compress.ContentCoding
All Implemented Interfaces:
Serializable, Comparable<ContentCoding>, java.lang.constant.Constable

public enum ContentCoding extends Enum<ContentCoding>
Enumeration of the canonical IANA content-coding tokens supported by HttpClient for HTTP request and response bodies.

Each constant corresponds to the standard token used in the Content-Encoding and Accept-Encoding headers. Some codings (e.g. Brotli, Zstandard, XZ/LZMA) may require additional helper libraries at runtime.

Since:
5.6
  • Enum Constant Details

    • GZIP

      public static final ContentCoding GZIP
      GZIP compression format.
    • DEFLATE

      public static final ContentCoding DEFLATE
      "deflate" compression format (zlib or raw).
    • X_GZIP

      public static final ContentCoding X_GZIP
      Legacy alias for GZIP.
    • BROTLI

      public static final ContentCoding BROTLI
      Brotli compression format.
    • ZSTD

      public static final ContentCoding ZSTD
      Zstandard compression format.
    • XZ

      public static final ContentCoding XZ
      XZ compression format.
    • LZMA

      public static final ContentCoding LZMA
      LZMA compression format.
    • LZ4_FRAMED

      public static final ContentCoding LZ4_FRAMED
      Framed LZ4 compression format.
    • LZ4_BLOCK

      public static final ContentCoding LZ4_BLOCK
      Block LZ4 compression format.
    • BZIP2

      public static final ContentCoding BZIP2
      BZIP2 compression format.
    • PACK200

      public static final ContentCoding PACK200
      Pack200 compression format.
    • DEFLATE64

      public static final ContentCoding DEFLATE64
      Deflate64 compression format.
  • Field Details

  • Constructor Details

    • ContentCoding

      private ContentCoding(String token)
  • Method Details

    • values

      public static ContentCoding[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ContentCoding valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • token

      public String token()
      Returns the standard IANA token string for this content-coding.
      Returns:
      the lowercase token used in HTTP headers
    • fromToken

      public static ContentCoding fromToken(String token)
      Lookup an enum by its token (case‐insensitive), or null if none matches.

      This method is backed by a static, pre‐populated map so the lookup is O(1) instead of O(n).

      Parameters:
      token - the content‐coding token to look up
      Returns:
      the matching enum constant, or null if none