org.apache.hc.client5.http.entity.compress

## Enum ContentCoding

- java.lang.Object
- - java.lang.Enum<ContentCoding>
  - - org.apache.hc.client5.http.entity.compress.ContentCoding

All Implemented Interfaces:
  Serializable, Comparable<ContentCoding>

    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 Summary

Enum Constants
Enum Constant and Description
`BROTLI` Brotli compression format.
`BZIP2` BZIP2 compression format.
`DEFLATE` "deflate" compression format (zlib or raw).
`DEFLATE64` Deflate64 compression format.
`GZIP` GZIP compression format.
`LZ4_BLOCK` Block LZ4 compression format.
`LZ4_FRAMED` Framed LZ4 compression format.
`LZMA` LZMA compression format.
`PACK200` Pack200 compression format.
`X_GZIP` Legacy alias for GZIP.
`XZ` XZ compression format.
`ZSTD` Zstandard compression format.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static ContentCoding` `fromToken(String token)` Lookup an enum by its token (case‐insensitive), or `null` if none matches.
`String` `token()` Returns the standard IANA token string for this content-coding.
`static ContentCoding` `valueOf(String name)` Returns the enum constant of this type with the specified name.
`static ContentCoding[]` `values()` Returns an array containing the constants of this enum type, in the order they are declared.

### Methods inherited from class java.lang.Enum

`clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

`getClass, notify, notifyAll, wait, wait, wait`

### Enum Constant Detail

#### 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.

### Method Detail

#### values

    public static ContentCoding[] values()

Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

    for (ContentCoding c : ContentCoding.values())
        System.out.println(c);

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