A decoder that splits the received {@link ChannelBuffer}s by one or more delimiters. It is particularly useful for decoding the frames which ends with a delimiter such as {@link Delimiters#nulDelimiter() NUL} or{@linkplain Delimiters#lineDelimiter() newline characters}.
Predefined delimiters
{@link Delimiters} defines frequently used delimiters for convenience' sake.
Specifying more than one delimiter
{@link DelimiterBasedFrameDecoder} allows you to specify more than onedelimiter. If more than one delimiter is found in the buffer, it chooses the delimiter which produces the shortest frame. For example, if you have the following data in the buffer:
+--------------+ | ABC\nDEF\r\n | +--------------+
a {@link DelimiterBasedFrameDecoder}{@code (}{@link Delimiters#lineDelimiter() Delimiters.lineDelimiter()}{@code )}will choose {@code '\n'} as the first delimiter and produce two frames:
+-----+-----+ | ABC | DEF | +-----+-----+
rather than incorrectly choosing {@code '\r\n'} as the first delimiter:
+----------+ | ABC\nDEF | +----------+
@apiviz.uses io.netty.handler.codec.frame.Delimiters - - useful