Home / Class/ DelimiterBasedFrameDecoder Class — netty Architecture

DelimiterBasedFrameDecoder Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  7590eb23_fb43_56c3_4de3_56dbec1f1149["DelimiterBasedFrameDecoder"]
  be6ddd9f_8898_d363_a92d_f51b6f840735["DelimiterBasedFrameDecoder.java"]
  7590eb23_fb43_56c3_4de3_56dbec1f1149 -->|defined in| be6ddd9f_8898_d363_a92d_f51b6f840735
  688becb4_e620_53c7_e54c_e090a4b90d55["DelimiterBasedFrameDecoder()"]
  7590eb23_fb43_56c3_4de3_56dbec1f1149 -->|method| 688becb4_e620_53c7_e54c_e090a4b90d55
  457d5822_f5e0_5eb8_4765_30776c030ea2["isLineBased()"]
  7590eb23_fb43_56c3_4de3_56dbec1f1149 -->|method| 457d5822_f5e0_5eb8_4765_30776c030ea2
  e815a942_36d1_8271_c090_306dd34b492f["isSubclass()"]
  7590eb23_fb43_56c3_4de3_56dbec1f1149 -->|method| e815a942_36d1_8271_c090_306dd34b492f
  e196054f_18fc_682e_e17c_e0c7cd46549a["decode()"]
  7590eb23_fb43_56c3_4de3_56dbec1f1149 -->|method| e196054f_18fc_682e_e17c_e0c7cd46549a
  abfd070d_4226_1951_b9b5_41207235cf3b["Object()"]
  7590eb23_fb43_56c3_4de3_56dbec1f1149 -->|method| abfd070d_4226_1951_b9b5_41207235cf3b
  2cb47d94_14e0_d6f2_0b0b_3fa3f6e3726b["fail()"]
  7590eb23_fb43_56c3_4de3_56dbec1f1149 -->|method| 2cb47d94_14e0_d6f2_0b0b_3fa3f6e3726b
  9455cfd7_2bf3_7b75_5247_f6002d1686f5["indexOf()"]
  7590eb23_fb43_56c3_4de3_56dbec1f1149 -->|method| 9455cfd7_2bf3_7b75_5247_f6002d1686f5
  14e6955f_4150_f564_5d76_7e7bc5201f70["validateDelimiter()"]
  7590eb23_fb43_56c3_4de3_56dbec1f1149 -->|method| 14e6955f_4150_f564_5d76_7e7bc5201f70
  762adede_a99b_33ac_377f_accbf254b670["validateMaxFrameLength()"]
  7590eb23_fb43_56c3_4de3_56dbec1f1149 -->|method| 762adede_a99b_33ac_377f_accbf254b670

Relationship Graph

Source Code

codec-base/src/main/java/io/netty/handler/codec/DelimiterBasedFrameDecoder.java lines 62–332

public class DelimiterBasedFrameDecoder extends ByteToMessageDecoder {

    private final ByteBuf[] delimiters;
    private final int maxFrameLength;
    private final boolean stripDelimiter;
    private final boolean failFast;
    private boolean discardingTooLongFrame;
    private int tooLongFrameLength;
    /** Set only when decoding with "\n" and "\r\n" as the delimiter.  */
    private final LineBasedFrameDecoder lineBasedDecoder;

    /**
     * Creates a new instance.
     *
     * @param maxFrameLength  the maximum length of the decoded frame.
     *                        A {@link TooLongFrameException} is thrown if
     *                        the length of the frame exceeds this value.
     * @param delimiter  the delimiter
     */
    public DelimiterBasedFrameDecoder(int maxFrameLength, ByteBuf delimiter) {
        this(maxFrameLength, true, delimiter);
    }

    /**
     * Creates a new instance.
     *
     * @param maxFrameLength  the maximum length of the decoded frame.
     *                        A {@link TooLongFrameException} is thrown if
     *                        the length of the frame exceeds this value.
     * @param stripDelimiter  whether the decoded frame should strip out the
     *                        delimiter or not
     * @param delimiter  the delimiter
     */
    public DelimiterBasedFrameDecoder(
            int maxFrameLength, boolean stripDelimiter, ByteBuf delimiter) {
        this(maxFrameLength, stripDelimiter, true, delimiter);
    }

    /**
     * Creates a new instance.
     *
     * @param maxFrameLength  the maximum length of the decoded frame.
     *                        A {@link TooLongFrameException} is thrown if
     *                        the length of the frame exceeds this value.
     * @param stripDelimiter  whether the decoded frame should strip out the
     *                        delimiter or not
     * @param failFast  If <tt>true</tt>, a {@link TooLongFrameException} is
     *                  thrown as soon as the decoder notices the length of the
     *                  frame will exceed <tt>maxFrameLength</tt> regardless of
     *                  whether the entire frame has been read.
     *                  If <tt>false</tt>, a {@link TooLongFrameException} is
     *                  thrown after the entire frame that exceeds
     *                  <tt>maxFrameLength</tt> has been read.
     * @param delimiter  the delimiter
     */
    public DelimiterBasedFrameDecoder(
            int maxFrameLength, boolean stripDelimiter, boolean failFast,
            ByteBuf delimiter) {
        this(maxFrameLength, stripDelimiter, failFast, new ByteBuf[] {
                delimiter.slice(delimiter.readerIndex(), delimiter.readableBytes())});
    }

    /**
     * Creates a new instance.
     *
     * @param maxFrameLength  the maximum length of the decoded frame.
     *                        A {@link TooLongFrameException} is thrown if
     *                        the length of the frame exceeds this value.
     * @param delimiters  the delimiters
     */
    public DelimiterBasedFrameDecoder(int maxFrameLength, ByteBuf... delimiters) {
        this(maxFrameLength, true, delimiters);
    }

    /**
     * Creates a new instance.
     *
     * @param maxFrameLength  the maximum length of the decoded frame.
     *                        A {@link TooLongFrameException} is thrown if
     *                        the length of the frame exceeds this value.
     * @param stripDelimiter  whether the decoded frame should strip out the

Frequently Asked Questions

What is the DelimiterBasedFrameDecoder class?
DelimiterBasedFrameDecoder is a class in the netty codebase, defined in codec-base/src/main/java/io/netty/handler/codec/DelimiterBasedFrameDecoder.java.
Where is DelimiterBasedFrameDecoder defined?
DelimiterBasedFrameDecoder is defined in codec-base/src/main/java/io/netty/handler/codec/DelimiterBasedFrameDecoder.java at line 62.

Analyze Your Own Codebase

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

Try Supermodel Free