code: protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
          if (discardingTooLongFrame) {
              discardingTooLongFrame(in);
          }
  
          if (in.readableBytes() < lengthFieldEndOffset) {
              return null;
          }
  
          int actualLengthFieldOffset = in.readerIndex() + lengthFieldOffset;
          long frameLength = getUnadjustedFrameLength(in, actualLengthFieldOffset, lengthFieldLength, byteOrder);
  
          if (frameLength < 0) {
              failOnNegativeLengthField(in, frameLength, lengthFieldEndOffset);
          }
  
          frameLength += lengthAdjustment + lengthFieldEndOffset;
  
          if (frameLength < lengthFieldEndOffset) {
              failOnFrameLengthLessThanLengthFieldEndOffset(in, frameLength, lengthFieldEndOffset);
          }
  
          if (frameLength > maxFrameLength) {
              exceededFrameLength(in, frameLength);
              return null;
          }
  
          // never overflows because it's less than maxFrameLength
          int frameLengthInt = (int) frameLength;
          if (in.readableBytes() < frameLengthInt) {
              return null;
          }
  
          if (initialBytesToStrip > frameLengthInt) {
              failOnFrameLengthLessThanInitialBytesToStrip(in, frameLength, initialBytesToStrip);
          }
          in.skipBytes(initialBytesToStrip);
  
          // extract frame
          int readerIndex = in.readerIndex();
          int actualFrameLength = frameLengthInt - initialBytesToStrip;
          ByteBuf frame = extractFrame(ctx, in, readerIndex, actualFrameLength);
          in.readerIndex(readerIndex + actualFrameLength);
          return frame;
      }
docs: Create a frame out of the {@link ByteBuf} and return it.
  
  @param   ctx             the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to
  @param   in              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.