Home / Function/ decode() — netty Function Reference

decode() — netty Function Reference

Architecture documentation for the decode() function in CleartextHttp2ServerUpgradeHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  18e7382b_2e92_617f_b6b3_cfb23db693a7["decode()"]
  8437dc8d_808f_d72e_cee8_b6e3a5bf8173["CleartextHttp2ServerUpgradeHandler"]
  18e7382b_2e92_617f_b6b3_cfb23db693a7 -->|defined in| 8437dc8d_808f_d72e_cee8_b6e3a5bf8173
  style 18e7382b_2e92_617f_b6b3_cfb23db693a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/CleartextHttp2ServerUpgradeHandler.java lines 74–94

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        int prefaceLength = CONNECTION_PREFACE.readableBytes();
        int bytesRead = Math.min(in.readableBytes(), prefaceLength);

        if (!ByteBufUtil.equals(CONNECTION_PREFACE, CONNECTION_PREFACE.readerIndex(),
                in, in.readerIndex(), bytesRead)) {
            ctx.pipeline().remove(this);
        } else if (bytesRead == prefaceLength) {
            // Full h2 preface match, removed source codec, using http2 codec to handle
            // following network traffic
            ctx.pipeline()
                    .remove(httpServerCodec)
                    .remove(httpServerUpgradeHandler);

            ctx.pipeline().addAfter(ctx.name(), null, http2ServerHandler);
            ctx.pipeline().remove(this);

            ctx.fireUserEventTriggered(PriorKnowledgeUpgradeEvent.INSTANCE);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does decode() do?
decode() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/CleartextHttp2ServerUpgradeHandler.java.
Where is decode() defined?
decode() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/CleartextHttp2ServerUpgradeHandler.java at line 74.

Analyze Your Own Codebase

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

Try Supermodel Free