System.IO.Compression.InputBuffer.SkipToByteBoundary C# (CSharp) Method

SkipToByteBoundary() public method

public SkipToByteBoundary ( ) : void
return void
        public void SkipToByteBoundary() {
            this.bitBuffer = this.bitBuffer >> (this.bitsInBuffer % 8);
            this.bitsInBuffer -= this.bitsInBuffer % 8;
        }

Usage Example

        public bool ReadFooter(InputBuffer input)
        {
            input.SkipToByteBoundary();
            if (gzipFooterSubstate == GzipHeaderState.ReadingCRC)
            {
                while (loopCounter < 4)
                {
                    int bits = input.GetBits(8);
                    if (bits < 0)
                    {
                        return(false);
                    }

                    expectedCrc32 |= ((uint)bits << (8 * loopCounter));
                    loopCounter++;
                }
                gzipFooterSubstate = GzipHeaderState.ReadingFileSize;
                loopCounter        = 0;
            }

            if (gzipFooterSubstate == GzipHeaderState.ReadingFileSize)
            {
                if (loopCounter == 0)
                {
                    expectedOutputStreamSizeModulo = 0;
                }

                while (loopCounter < 4)
                {
                    int bits = input.GetBits(8);
                    if (bits < 0)
                    {
                        return(false);
                    }

                    expectedOutputStreamSizeModulo |= ((uint)bits << (8 * loopCounter));
                    loopCounter++;
                }
            }

            return(true);
        }
All Usage Examples Of System.IO.Compression.InputBuffer::SkipToByteBoundary