Beispiel #1
0
        public void UpdateWithBytesRead(byte[] buffer, int offset, int bytesToCopy)
        {
            this._crc32 = Crc32Helper.UpdateCrc32(this._crc32, buffer, offset, bytesToCopy);
            long num = this._inputStreamSizeModulo + (long)((ulong)bytesToCopy);

            if (num >= 4294967296L)
            {
                num %= 4294967296L;
            }
            this._inputStreamSizeModulo = num;
        }
Beispiel #2
0
        public void UpdateWithBytesRead(byte[] buffer, int offset, int copied)
        {
            this.actualCrc32 = Crc32Helper.UpdateCrc32(this.actualCrc32, buffer, offset, copied);
            long num = this.actualStreamSizeModulo + (long)((ulong)copied);

            if (num >= 4294967296L)
            {
                num %= 4294967296L;
            }
            this.actualStreamSizeModulo = num;
        }
Beispiel #3
0
        public void UpdateWithBytesRead(Byte[] buffer, Int32 offset, Int32 copied)
        {
            this.actualCrc32 = Crc32Helper.UpdateCrc32(this.actualCrc32, buffer, offset, copied);
            Int64 num = this.actualStreamSizeModulo + (Int64)((UInt64)copied);

            if (num >= 4294967296L)
            {
                num %= 4294967296L;
            }
            this.actualStreamSizeModulo = num;
        }
Beispiel #4
0
        public void UpdateWithBytesRead(Byte[] buffer, Int32 offset, Int32 bytesToCopy)
        {
            this._crc32 = Crc32Helper.UpdateCrc32(this._crc32, buffer, offset, bytesToCopy);
            Int64 num = this._inputStreamSizeModulo + (Int64)((UInt64)bytesToCopy);

            if (num >= 4294967296L)
            {
                num %= 4294967296L;
            }
            this._inputStreamSizeModulo = num;
        }
Beispiel #5
0
        public void UpdateWithBytesRead(byte[] buffer, int offset, int copied)
        {
            actualCrc32 = Crc32Helper.UpdateCrc32(actualCrc32, buffer, offset, copied);

            var n = actualStreamSizeModulo + (uint)copied;

            if (n >= GZipConstants.FileLengthModulo)
            {
                n %= GZipConstants.FileLengthModulo;
            }
            actualStreamSizeModulo = n;
        }
Beispiel #6
0
        public void UpdateWithBytesRead(byte[] buffer, int offset, int bytesToCopy)
        {
            _crc32 = Crc32Helper.UpdateCrc32(_crc32, buffer, offset, bytesToCopy);

            long n = _inputStreamSizeModulo + (uint)bytesToCopy;

            if (n >= GZipConstants.FileLengthModulo)
            {
                n %= GZipConstants.FileLengthModulo;
            }
            _inputStreamSizeModulo = n;
        }
Beispiel #7
0
        public override void Write(Byte[] buffer, Int32 offset, Int32 count)
        {
            //we can't pass the argument checking down a level
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }
            if (offset < 0)
            {
                throw new ArgumentOutOfRangeException("offset", SR.ArgumentNeedNonNegative);
            }
            if (count < 0)
            {
                throw new ArgumentOutOfRangeException("count", SR.ArgumentNeedNonNegative);
            }
            if ((buffer.Length - offset) < count)
            {
                throw new ArgumentException(SR.OffsetLengthInvalid);
            }
            //Contract.EndContractBlock();

            //if we're not actually writing anything, we don't want to trigger as if we did write something
            ThrowIfDisposed();
            Debug.Assert(CanWrite);

            if (count == 0)
            {
                return;
            }

            if (!_everWritten)
            {
                _initialPosition = _baseBaseStream.Position;
                _everWritten     = true;
            }

            _checksum = Crc32Helper.UpdateCrc32(_checksum, buffer, offset, count);
            _baseStream.Write(buffer, offset, count);
            _position += count;
        }