Home / Function/ readPreamble() — netty Function Reference

readPreamble() — netty Function Reference

Architecture documentation for the readPreamble() function in Snappy.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  61395c44_d8f1_2ccc_d61d_8a1707cbc191["readPreamble()"]
  6a7984ff_ded6_5ba2_b4bb_f92d0d3986f8["Snappy"]
  61395c44_d8f1_2ccc_d61d_8a1707cbc191 -->|defined in| 6a7984ff_ded6_5ba2_b4bb_f92d0d3986f8
  f2623adf_f9d0_6b9a_01bf_992a8c89c1e8["decode()"]
  f2623adf_f9d0_6b9a_01bf_992a8c89c1e8 -->|calls| 61395c44_d8f1_2ccc_d61d_8a1707cbc191
  348092d9_1c54_5b25_949b_b8e64329260f["getPreamble()"]
  348092d9_1c54_5b25_949b_b8e64329260f -->|calls| 61395c44_d8f1_2ccc_d61d_8a1707cbc191
  style 61395c44_d8f1_2ccc_d61d_8a1707cbc191 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-compression/src/main/java/io/netty/handler/codec/compression/Snappy.java lines 404–420

    private static int readPreamble(ByteBuf in) {
        int length = 0;
        int byteIndex = 0;
        while (in.isReadable()) {
            int current = in.readUnsignedByte();
            length |= (current & 0x7f) << byteIndex++ * 7;
            if ((current & 0x80) == 0) {
                return length;
            }

            if (byteIndex >= 4) {
                throw new DecompressionException("Preamble is greater than 4 bytes");
            }
        }

        return 0;
    }

Domain

Subdomains

Frequently Asked Questions

What does readPreamble() do?
readPreamble() is a function in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Snappy.java.
Where is readPreamble() defined?
readPreamble() is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Snappy.java at line 404.
What calls readPreamble()?
readPreamble() is called by 2 function(s): decode, getPreamble.

Analyze Your Own Codebase

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

Try Supermodel Free