Class CompressionSettings.Brotli

java.lang.Object
com.iizix.jetty.CompressionSettings.Brotli
Enclosing class:
CompressionSettings

public static final class CompressionSettings.Brotli extends Object
Default settings for the Brotli compression algorithm (BrotliCompression).

Backed by the Brotli4j native library (bundled inside the jetty-compression-brotli jar for the major platforms: Linux x64, macOS x64 + aarch64, Windows x64). Supported by all modern browsers (Chrome 50+, Firefox 44+, Safari 11+, Edge 15+).

Brotli typically beats gzip by 15-25% on text/HTML/JS/CSS at comparable encoding cost (quality 4-6) and by 25-40% at quality 11 (which is significantly slower). Defaults below favour ratio.

  • Field Details

    • QUALITY

      public static volatile int QUALITY
      Brotli quality level (analogous to gzip's compression level).

      Possible values: 0 (fastest, lowest ratio) through 11 (slowest, best ratio). Reference points:

      • 4 -- typical live HTTP serving level, comparable speed to gzip 6
      • 6 -- balanced
      • 9..11 -- typical for pre-compressed static assets where encoding cost is paid once at build time

      Default: 11 (maximum compression).

    • WINDOW

      public static volatile int WINDOW
      Brotli sliding window size, expressed in bits (the so-called lgwin parameter -- window is 1 << WINDOW bytes).

      Possible values: 10 (1 KiB window) through 24 (16 MiB window). Larger windows improve compression on long, repetitive inputs but use proportionally more memory during encoding.

      Default: 24 (maximum -- best ratio for typical web assets).

    • BUFFER_SIZE

      public static volatile int BUFFER_SIZE
      Encoder buffer size in bytes.

      Possible values: any positive int; practical range 8192..131072.

      Default: 32768 (32 KiB).