Home / Function/ encode() — netty Function Reference

encode() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  5573ef2d_3bbd_33e2_e191_149c583772d1["encode()"]
  119e0418_980a_9c49_2161_22769a680775["MarshallingEncoder"]
  5573ef2d_3bbd_33e2_e191_149c583772d1 -->|defined in| 119e0418_980a_9c49_2161_22769a680775
  style 5573ef2d_3bbd_33e2_e191_149c583772d1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-marshalling/src/main/java/io/netty/handler/codec/marshalling/MarshallingEncoder.java lines 53–65

    @Override
    protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
        Marshaller marshaller = provider.getMarshaller(ctx);
        int lengthPos = out.writerIndex();
        out.writeBytes(LENGTH_PLACEHOLDER);
        ChannelBufferByteOutput output = new ChannelBufferByteOutput(out);
        marshaller.start(output);
        marshaller.writeObject(msg);
        marshaller.finish();
        marshaller.close();

        out.setInt(lengthPos, out.writerIndex() - lengthPos - 4);
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free