Home / Class/ CompatibleMarshallingEncoder Class — netty Architecture

CompatibleMarshallingEncoder Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  337fe5ad_a8e2_ef19_f18b_966ce0b844e4["CompatibleMarshallingEncoder"]
  eabb8a4b_6e45_6ed8_4b20_811480caf8a0["CompatibleMarshallingEncoder.java"]
  337fe5ad_a8e2_ef19_f18b_966ce0b844e4 -->|defined in| eabb8a4b_6e45_6ed8_4b20_811480caf8a0
  85fa5372_3cd7_3e22_26dc_ffc526110a1d["CompatibleMarshallingEncoder()"]
  337fe5ad_a8e2_ef19_f18b_966ce0b844e4 -->|method| 85fa5372_3cd7_3e22_26dc_ffc526110a1d
  0c04abc7_7ee9_0fd6_aa7a_05e8312e3536["encode()"]
  337fe5ad_a8e2_ef19_f18b_966ce0b844e4 -->|method| 0c04abc7_7ee9_0fd6_aa7a_05e8312e3536

Relationship Graph

Source Code

codec-marshalling/src/main/java/io/netty/handler/codec/marshalling/CompatibleMarshallingEncoder.java lines 36–60

@Sharable
public class CompatibleMarshallingEncoder extends MessageToByteEncoder<Object> {

    private final MarshallerProvider provider;

    /**
     * Create a new instance of the {@link CompatibleMarshallingEncoder}
     *
     * @param provider  the {@link MarshallerProvider} to use to get the {@link Marshaller} for a {@link Channel}
     */
    public CompatibleMarshallingEncoder(MarshallerProvider provider) {
        super(Object.class);
        this.provider = provider;
    }

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

}

Frequently Asked Questions

What is the CompatibleMarshallingEncoder class?
CompatibleMarshallingEncoder is a class in the netty codebase, defined in codec-marshalling/src/main/java/io/netty/handler/codec/marshalling/CompatibleMarshallingEncoder.java.
Where is CompatibleMarshallingEncoder defined?
CompatibleMarshallingEncoder is defined in codec-marshalling/src/main/java/io/netty/handler/codec/marshalling/CompatibleMarshallingEncoder.java at line 36.

Analyze Your Own Codebase

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

Try Supermodel Free