Home / Function/ channelRead0() — netty Function Reference

channelRead0() — netty Function Reference

Architecture documentation for the channelRead0() function in HttpResponseClientHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f8e6f22a_1791_68fe_14f7_5f64c6747999["channelRead0()"]
  87aa9984_48b3_c4f0_3656_aa8dcb7d0830["HttpResponseClientHandler"]
  f8e6f22a_1791_68fe_14f7_5f64c6747999 -->|defined in| 87aa9984_48b3_c4f0_3656_aa8dcb7d0830
  style f8e6f22a_1791_68fe_14f7_5f64c6747999 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/spdy/client/HttpResponseClientHandler.java lines 40–75

    @Override
    public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
        if (msg instanceof HttpResponse) {
            HttpResponse response = (HttpResponse) msg;

            System.out.println("STATUS: " + response.status());
            System.out.println("VERSION: " + response.protocolVersion());
            System.out.println();

            if (!response.headers().isEmpty()) {
                for (CharSequence name : response.headers().names()) {
                    for (CharSequence value : response.headers().getAll(name)) {
                        System.out.println("HEADER: " + name + " = " + value);
                    }
                }
                System.out.println();
            }

            if (HttpUtil.isTransferEncodingChunked(response)) {
                System.out.println("CHUNKED CONTENT {");
            } else {
                System.out.println("CONTENT {");
            }
        }
        if (msg instanceof HttpContent) {
            HttpContent content = (HttpContent) msg;

            System.out.print(content.content().toString(CharsetUtil.UTF_8));
            System.out.flush();

            if (content instanceof LastHttpContent) {
                System.out.println("} END OF CONTENT");
                queue.add(ctx.channel().newSucceededFuture());
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does channelRead0() do?
channelRead0() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/spdy/client/HttpResponseClientHandler.java.
Where is channelRead0() defined?
channelRead0() is defined in example/src/main/java/io/netty/example/spdy/client/HttpResponseClientHandler.java at line 40.

Analyze Your Own Codebase

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

Try Supermodel Free