code: protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
          final int eol = findEndOfLine(buffer);
          if (!discarding) {
              if (eol >= 0) {
                  final ByteBuf frame;
                  final int length = eol - buffer.readerIndex();
                  final int delimLength = buffer.getByte(eol) == '\r'? 2 : 1;
  
                  if (length > maxLength) {
                      buffer.readerIndex(eol + delimLength);
                      fail(ctx, length);
                      return null;
                  }
  
                  if (stripDelimiter) {
                      frame = buffer.readRetainedSlice(length);
                      buffer.skipBytes(delimLength);
                  } else {
                      frame = buffer.readRetainedSlice(length + delimLength);
                  }
  
                  return frame;
              } else {
                  final int length = buffer.readableBytes();
                  if (length > maxLength) {
                      discardedBytes = length;
                      buffer.readerIndex(buffer.writerIndex());
                      discarding = true;
                      offset = 0;
                      if (failFast) {
                          fail(ctx, "over " + discardedBytes);
                      }
                  }
                  return null;
              }
          } else {
              if (eol >= 0) {
                  final int length = discardedBytes + eol - buffer.readerIndex();
                  final int delimLength = buffer.getByte(eol) == '\r'? 2 : 1;
                  buffer.readerIndex(eol + delimLength);
                  discardedBytes = 0;
                  discarding = false;
                  if (!failFast) {
                      fail(ctx, length);
                  }
              } else {
                  discardedBytes += buffer.readableBytes();
                  buffer.readerIndex(buffer.writerIndex());
                  // We skip everything in the buffer, we need to set the offset to 0 again.
                  offset = 0;
              }
              return null;
          }
      }
docs: Create a frame out of the {@link ByteBuf} and return it.
  
  @param   ctx             the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to
  @param   buffer          the {@link ByteBuf} from which to read data
  @return  frame           the {@link ByteBuf} which represent the frame or {@code null} if no frame could
  be created.