Home / Class/ ByteBufForwarder Class — netty Architecture

ByteBufForwarder Class — netty Architecture

Architecture documentation for the ByteBufForwarder class in HttpContentDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  1c0fa724_272e_7330_7042_897c66755571["ByteBufForwarder"]
  b8280e46_90a7_c2ed_4ae7_21e99e1628e2["HttpContentDecoder.java"]
  1c0fa724_272e_7330_7042_897c66755571 -->|defined in| b8280e46_90a7_c2ed_4ae7_21e99e1628e2
  b12dbedd_b0f7_1773_724a_2735097aa3cf["ByteBufForwarder()"]
  1c0fa724_272e_7330_7042_897c66755571 -->|method| b12dbedd_b0f7_1773_724a_2735097aa3cf
  0defcf3c_b818_647b_8843_ea7d04cd5e16["isSharable()"]
  1c0fa724_272e_7330_7042_897c66755571 -->|method| 0defcf3c_b818_647b_8843_ea7d04cd5e16
  aacb0e80_b6a6_5654_c110_8e202460f142["channelRead()"]
  1c0fa724_272e_7330_7042_897c66755571 -->|method| aacb0e80_b6a6_5654_c110_8e202460f142

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpContentDecoder.java lines 270–295

    private final class ByteBufForwarder extends ChannelInboundHandlerAdapter {

        private final ChannelHandlerContext targetCtx;

        ByteBufForwarder(ChannelHandlerContext targetCtx) {
            this.targetCtx = targetCtx;
        }

        @Override
        public boolean isSharable() {
            // We need to mark the handler as sharable as we will add it to every EmbeddedChannel that is
            // generated.
            return true;
        }

        @Override
        public void channelRead(ChannelHandlerContext ctx, Object msg) {
            ByteBuf buf = (ByteBuf) msg;
            if (!buf.isReadable()) {
                buf.release();
                return;
            }
            needRead = false;
            targetCtx.fireChannelRead(new DefaultHttpContent(buf));
        }
    }

Frequently Asked Questions

What is the ByteBufForwarder class?
ByteBufForwarder is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentDecoder.java.
Where is ByteBufForwarder defined?
ByteBufForwarder is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentDecoder.java at line 270.

Analyze Your Own Codebase

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

Try Supermodel Free