Enum ContentCoding
- java.lang.Object
-
- java.lang.Enum<ContentCoding>
-
- org.apache.hc.client5.http.entity.compress.ContentCoding
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<ContentCoding>
public enum ContentCoding extends java.lang.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-EncodingandAccept-Encodingheaders. 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 Description BROTLIBrotli compression format.BZIP2BZIP2 compression format.DEFLATE"deflate" compression format (zlib or raw).DEFLATE64Deflate64 compression format.GZIPGZIP compression format.LZ4_BLOCKBlock LZ4 compression format.LZ4_FRAMEDFramed LZ4 compression format.LZMALZMA compression format.PACK200Pack200 compression format.X_GZIPLegacy alias for GZIP.XZXZ compression format.ZSTDZstandard compression format.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringtokenprivate static java.util.Map<java.lang.String,ContentCoding>TOKEN_LOOKUP
-
Constructor Summary
Constructors Modifier Constructor Description privateContentCoding(java.lang.String token)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ContentCodingfromToken(java.lang.String token)Lookup an enum by its token (case‐insensitive), ornullif none matches.java.lang.Stringtoken()Returns the standard IANA token string for this content-coding.static ContentCodingvalueOf(java.lang.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.
-
-
-
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.
-
-
Field Detail
-
TOKEN_LOOKUP
private static final java.util.Map<java.lang.String,ContentCoding> TOKEN_LOOKUP
-
token
private final java.lang.String token
-
-
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(java.lang.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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
token
public java.lang.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(java.lang.String token)
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
-
-