Class CompressionSettings.Gzip
- Enclosing class:
CompressionSettings
GzipCompression).Backed by Deflater. Universally supported by browsers and HTTP clients. Defaults below favour compression ratio over encoding speed.
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intEncoder buffer size in bytes.static intDeflate compression level.static intCapacity of theDeflaterPoolholding reusableDeflaterinstances for outbound compression.static intCapacity of theInflaterPoolholding reusableInflaterinstances for inbound decompression (gzipped request bodies).static intDeflate compression strategy.static booleanWhether the encoder usesDeflater.SYNC_FLUSHwhen flushing.Method Summary
Field Details
COMPRESSION_LEVEL
public static volatile int COMPRESSION_LEVELDeflate compression level.Possible values:
0--Deflater.NO_COMPRESSION: store, no compression1--Deflater.BEST_SPEED: fastest, lowest ratio2..8-- intermediate levels9--Deflater.BEST_COMPRESSION: slowest, best ratio-1--Deflater.DEFAULT_COMPRESSION: equivalent to level 6
Default:
9(Deflater.BEST_COMPRESSION).STRATEGY
public static volatile int STRATEGYDeflate compression strategy.Possible values:
Deflater.DEFAULT_STRATEGY(0): general-purpose dataDeflater.FILTERED(1): biased for filtered data (PNG-style predictors)Deflater.HUFFMAN_ONLY(2): Huffman coding only, no LZ77 matching
Default:
Deflater.DEFAULT_STRATEGY(best for general text/HTML/JS/CSS).SYNC_FLUSH
public static volatile boolean SYNC_FLUSHWhether the encoder usesDeflater.SYNC_FLUSHwhen flushing.When
true, output is forced to a byte boundary after each write, allowing immediate decoding by the receiver at the cost of a small compression-ratio penalty. Useful for live streaming, harmful for static assets.Possible values:
false,true.Default:
false(better ratio).BUFFER_SIZE
public static volatile int BUFFER_SIZEEncoder buffer size in bytes.Possible values: any positive
int; practical range4096..262144. Larger buffers slightly improve compression and reduce syscall overhead but use proportionally more memory per active encoding stream.Default:
32768(32 KiB).DEFLATER_POOL_CAPACITY
public static volatile int DEFLATER_POOL_CAPACITYCapacity of theDeflaterPoolholding reusableDeflaterinstances for outbound compression.The pool grows on demand up to this cap; deflaters released beyond the cap are closed rather than pooled. A larger cap reduces native- resource churn under high concurrency at the cost of resident memory.
Possible values:
0-- no pooling, create a fresh deflater per request (slow, GC churn)- positive
int-- pool cap (typical: 64..1024)
Default:
256.INFLATER_POOL_CAPACITY
public static volatile int INFLATER_POOL_CAPACITYCapacity of theInflaterPoolholding reusableInflaterinstances for inbound decompression (gzipped request bodies).Possible values: see
DEFLATER_POOL_CAPACITY.Default:
128(lower than deflater cap -- inbound gzipped bodies are rarer than outbound gzip responses for an iiziServer workload).