Enum ContentCoding
- All Implemented Interfaces:
Serializable, Comparable<ContentCoding>, java.lang.constant.Constable
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
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionBrotli compression format.BZIP2 compression format."deflate" compression format (zlib or raw).Deflate64 compression format.GZIP compression format.Block LZ4 compression format.Framed LZ4 compression format.LZMA compression format.Pack200 compression format.Legacy alias for GZIP.XZ compression format.Zstandard compression format. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate static final Map<String, ContentCoding> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ContentCodingLookup an enum by its token (case‐insensitive), ornullif none matches.token()Returns the standard IANA token string for this content-coding.static ContentCodingReturns 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.
-
Enum Constant Details
-
GZIP
GZIP compression format. -
DEFLATE
"deflate" compression format (zlib or raw). -
X_GZIP
Legacy alias for GZIP. -
BROTLI
Brotli compression format. -
ZSTD
Zstandard compression format. -
XZ
XZ compression format. -
LZMA
LZMA compression format. -
LZ4_FRAMED
Framed LZ4 compression format. -
LZ4_BLOCK
Block LZ4 compression format. -
BZIP2
BZIP2 compression format. -
PACK200
Pack200 compression format. -
DEFLATE64
Deflate64 compression format.
-
-
Field Details
-
TOKEN_LOOKUP
-
token
-
-
Constructor Details
-
ContentCoding
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
token
Returns the standard IANA token string for this content-coding.- Returns:
- the lowercase token used in HTTP headers
-
fromToken
Lookup an enum by its token (case‐insensitive), ornullif 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
nullif none
-