Home / Function/ encode() — netty Function Reference

encode() — netty Function Reference

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

Function java Buffer Allocators calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  2f6f9195_61e1_597f_53c0_b36ef1d7b36a["encode()"]
  4a29aef3_e017_5f9e_e255_496a25a8988e["Lz4FrameEncoder"]
  2f6f9195_61e1_597f_53c0_b36ef1d7b36a -->|defined in| 4a29aef3_e017_5f9e_e255_496a25a8988e
  159fbf77_5b7d_bd62_3287_8d2df4c59091["flushBufferedData()"]
  159fbf77_5b7d_bd62_3287_8d2df4c59091 -->|calls| 2f6f9195_61e1_597f_53c0_b36ef1d7b36a
  159fbf77_5b7d_bd62_3287_8d2df4c59091["flushBufferedData()"]
  2f6f9195_61e1_597f_53c0_b36ef1d7b36a -->|calls| 159fbf77_5b7d_bd62_3287_8d2df4c59091
  style 2f6f9195_61e1_597f_53c0_b36ef1d7b36a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-compression/src/main/java/io/netty/handler/codec/compression/Lz4FrameEncoder.java lines 233–254

    @Override
    protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
        if (finished) {
            if (!out.isWritable(in.readableBytes())) {
                // out should be EMPTY_BUFFER because we should have allocated enough space above in allocateBuffer.
                throw new IllegalStateException("encode finished and not enough space to write remaining data");
            }
            out.writeBytes(in);
            return;
        }

        final ByteBuf buffer = this.buffer;
        int length;
        while ((length = in.readableBytes()) > 0) {
            final int nextChunkSize = Math.min(length, buffer.writableBytes());
            in.readBytes(buffer, nextChunkSize);

            if (!buffer.isWritable()) {
                flushBufferedData(out);
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does encode() do?
encode() is a function in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Lz4FrameEncoder.java.
Where is encode() defined?
encode() is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Lz4FrameEncoder.java at line 233.
What does encode() call?
encode() calls 1 function(s): flushBufferedData.
What calls encode()?
encode() is called by 1 function(s): flushBufferedData.

Analyze Your Own Codebase

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

Try Supermodel Free