public static HTTP2DataFrame ReadDataFrame(HTTP2FrameHeaderAndPayload header)
        {
            // https://httpwg.org/specs/rfc7540.html#DATA

            HTTP2DataFrame frame = new HTTP2DataFrame(header);

            frame.DataLength = header.PayloadLength;

            bool isPadded = (frame.Flags & HTTP2DataFlags.PADDED) != 0;

            if (isPadded)
            {
                frame.PadLength = header.Payload[0];

                uint subLength = (uint)(1 + (frame.PadLength ?? 0));
                if (subLength <= frame.DataLength)
                {
                    frame.DataLength -= subLength;
                }
                //else
                //    throw PROTOCOL_ERROR;
            }

            frame.DataIdx  = (UInt32)(isPadded ? 1 : 0);
            frame.Data     = header.Payload;
            header.Payload = null;

            return(frame);
        }
        protected override bool AdvanceFrame()
        {
            if (this.currentFrameIdx >= this.frames.Count - 1)
            {
                return(false);
            }

            this.currentFrameIdx++;
            HTTP2FrameHeaderAndPayload frame     = this.frames[this.currentFrameIdx];
            HTTP2DataFrame             dataFrame = HTTP2FrameHelper.ReadDataFrame(frame);

            this.data      = frame.Payload;
            this.offset    = dataFrame.DataIdx;
            this.maxOffset = dataFrame.DataIdx + dataFrame.DataLength;

            return(true);
        }