Home / Function/ encode() — netty Function Reference

encode() — netty Function Reference

Architecture documentation for the encode() function in TcpDnsQueryEncoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f35dbdea_2457_03c8_04da_f80ccfc62524["encode()"]
  ed85728f_8833_deba_ce65_210c2d56b62e["TcpDnsQueryEncoder"]
  f35dbdea_2457_03c8_04da_f80ccfc62524 -->|defined in| ed85728f_8833_deba_ce65_210c2d56b62e
  style f35dbdea_2457_03c8_04da_f80ccfc62524 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-dns/src/main/java/io/netty/handler/codec/dns/TcpDnsQueryEncoder.java lines 43–52

    @Override
    protected void encode(ChannelHandlerContext ctx, DnsQuery msg, ByteBuf out) throws Exception {
        // Length is two octets as defined by RFC-7766
        // See https://tools.ietf.org/html/rfc7766#section-8
        out.writerIndex(out.writerIndex() + 2);
        encoder.encode(msg, out);

        // Now fill in the correct length based on the amount of data that we wrote the ByteBuf.
        out.setShort(0, out.readableBytes() - 2);
    }

Subdomains

Frequently Asked Questions

What does encode() do?
encode() is a function in the netty codebase, defined in codec-dns/src/main/java/io/netty/handler/codec/dns/TcpDnsQueryEncoder.java.
Where is encode() defined?
encode() is defined in codec-dns/src/main/java/io/netty/handler/codec/dns/TcpDnsQueryEncoder.java at line 43.

Analyze Your Own Codebase

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

Try Supermodel Free