Home / Class/ Brotli Class — netty Architecture

Brotli Class — netty Architecture

Architecture documentation for the Brotli class in Brotli.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4c463c9e_f971_2a1a_bd19_f41237646833["Brotli"]
  fe45e8f6_c855_cb85_da05_693dbe5c7591["Brotli.java"]
  4c463c9e_f971_2a1a_bd19_f41237646833 -->|defined in| fe45e8f6_c855_cb85_da05_693dbe5c7591
  cf520cd4_b89e_42cc_2e3f_9d60785c8309["isAvailable()"]
  4c463c9e_f971_2a1a_bd19_f41237646833 -->|method| cf520cd4_b89e_42cc_2e3f_9d60785c8309
  fea45318_55f0_3efd_5d4d_9864a263ed6a["ensureAvailability()"]
  4c463c9e_f971_2a1a_bd19_f41237646833 -->|method| fea45318_55f0_3efd_5d4d_9864a263ed6a
  ef3dc9b5_d9a2_5f6a_b249_ddf5c0e9a226["Throwable()"]
  4c463c9e_f971_2a1a_bd19_f41237646833 -->|method| ef3dc9b5_d9a2_5f6a_b249_ddf5c0e9a226
  dafe5b44_b3c5_98c7_68d5_f7b7cdbdaf99["Brotli()"]
  4c463c9e_f971_2a1a_bd19_f41237646833 -->|method| dafe5b44_b3c5_98c7_68d5_f7b7cdbdaf99

Relationship Graph

Source Code

codec-compression/src/main/java/io/netty/handler/codec/compression/Brotli.java lines 24–83

public final class Brotli {

    private static final InternalLogger logger = InternalLoggerFactory.getInstance(Brotli.class);
    private static final ClassNotFoundException CNFE;
    private static Throwable cause;

    static {
        ClassNotFoundException cnfe = null;

        try {
            Class.forName("com.aayushatharva.brotli4j.Brotli4jLoader", false,
                PlatformDependent.getClassLoader(Brotli.class));
        } catch (ClassNotFoundException t) {
            cnfe = t;
            logger.debug(
                "brotli4j not in the classpath; Brotli support will be unavailable.");
        }

        CNFE = cnfe;

        // If in the classpath, try to load the native library and initialize brotli4j.
        if (cnfe == null) {
            cause = Brotli4jLoader.getUnavailabilityCause();
            if (cause != null) {
                logger.debug("Failed to load brotli4j; Brotli support will be unavailable.", cause);
            }
        }
    }

    /**
     *
     * @return true when brotli4j is in the classpath
     * and native library is available on this platform and could be loaded
     */
    public static boolean isAvailable() {
        return CNFE == null && Brotli4jLoader.isAvailable();
    }

    /**
     * Throws when brotli support is missing from the classpath or is unavailable on this platform
     * @throws Throwable a ClassNotFoundException if brotli4j is missing
     * or a UnsatisfiedLinkError if brotli4j native lib can't be loaded
     */
    public static void ensureAvailability() throws Throwable {
        if (CNFE != null) {
            throw CNFE;
        }
        Brotli4jLoader.ensureAvailability();
    }

    /**
     * Returns {@link Throwable} of unavailability cause
     */
    public static Throwable cause() {
        return cause;
    }

    private Brotli() {
    }
}

Frequently Asked Questions

What is the Brotli class?
Brotli is a class in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Brotli.java.
Where is Brotli defined?
Brotli is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Brotli.java at line 24.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free