code: private void processHeader() {
      int type = nextFrame.readUnsignedByte();
      if ((type & RESERVED_MASK) != 0) {
        throw Status.INTERNAL.withDescription(
            "gRPC frame header malformed: reserved bits not zero")
            .asRuntimeException();
      }
      compressedFlag = (type & COMPRESSED_FLAG_MASK) != 0;
  
      // Update the required length to include the length of the frame.
      requiredLength = nextFrame.readInt();
      if (requiredLength < 0 || requiredLength > maxInboundMessageSize) {
        throw Status.RESOURCE_EXHAUSTED.withDescription(
            String.format("gRPC message exceeds maximum size %d: %d",
                maxInboundMessageSize, requiredLength))
            .asRuntimeException();
      }
  
      currentMessageSeqNo++;
      statsTraceCtx.inboundMessage(currentMessageSeqNo);
      transportTracer.reportMessageReceived();
      // Continue reading the frame body.
      state = State.BODY;
    }
docs: Processes the GRPC compression header which is composed of the compression flag and the outer
  frame length.