@Nullable
    private static StreamEncoderFactory determineEncoder(String acceptEncoding) {
        float starQ = -1.0f;
        final Map<StreamEncoderFactory, Float> encodings = new LinkedHashMap<>();
        for (String encoding : acceptEncoding.split(",")) {
            float q = 1.0f;
            final int equalsPos = encoding.indexOf('=');
            if (equalsPos != -1) {
                try {
                    q = Float.parseFloat(encoding.substring(equalsPos + 1));
                } catch (NumberFormatException e) {
                    // Ignore encoding
                    q = 0.0f;
                }
            }
            if (encoding.contains("*")) {
                starQ = q;
            } else if (encoding.contains("br") && Brotli.isAvailable()) {
                encodings.put(StreamEncoderFactories.BROTLI, q);
            } else if (encoding.contains("gzip")) {
                encodings.put(StreamEncoderFactories.GZIP, q);
            } else if (encoding.contains("deflate")) {
                encodings.put(StreamEncoderFactories.DEFLATE, q);
            } else if (encoding.contains("x-snappy-framed")) {
                encodings.put(StreamEncoderFactories.SNAPPY, q);
            }
        }

        if (!encodings.isEmpty()) {
            final Entry<StreamEncoderFactory, Float> entry = Collections.max(encodings.entrySet(),
                                                                             Entry.comparingByValue());
            if (entry.getValue() > 0.0f) {
                return entry.getKey();
            }
        }
        if (starQ > 0.0f) {
            if (!encodings.containsKey(StreamEncoderFactories.BROTLI) && Brotli.isAvailable()) {
                return StreamEncoderFactories.BROTLI;
            }
            if (!encodings.containsKey(StreamEncoderFactories.GZIP)) {
                return StreamEncoderFactories.GZIP;
            }
            if (!encodings.containsKey(StreamEncoderFactories.DEFLATE)) {
                return StreamEncoderFactories.DEFLATE;
            }
            if (!encodings.containsKey(StreamEncoderFactories.SNAPPY)) {
                return StreamEncoderFactories.SNAPPY;
            }
        }
        return null;
    }
Support utilities for dealing with HTTP encoding (e.g., gzip).
core/src/main/java/com/linecorp/armeria/server/encoding/HttpEncoders.java