public void End() { this.deflateStream.Flush(); this.deflateStream.Close(); this.deflateWriter.Close(); if (!this.useTempStream) { long curPos = this.BaseStream.Position; this.BaseStream.Seek(this.baseStreamPosition, SeekOrigin.Begin); uint crc = CheckSum.ComputeHash(this.BaseStream, curPos - this.baseStreamPosition); this.BaseStream.Seek(this.baseStreamPosition - 4, SeekOrigin.Begin); this.writer.Write(crc); this.BaseStream.Seek(curPos, SeekOrigin.Begin); } else { this.tempStream.Seek(0, SeekOrigin.Begin); uint crc = CheckSum.ComputeHash(this.tempStream, this.tempStream.Length); this.writer.Write(crc); this.tempStream.Seek(0, SeekOrigin.Begin); StreamUtils.CopyStream(this.tempStream, this.BaseStream, (int)this.tempStream.Length); this.tempStream.Close(); this.tempStream = null; } }
public void WriteContent(Stream contentStream, int length) { StreamUtils.CopyStream(contentStream, this.deflateStream, length); }
public void ReadContent(Stream destStream, int length) { StreamUtils.CopyStream(this.BaseStream, destStream, length); }