コード例 #1
0
        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;
            }
        }
コード例 #2
0
 public void WriteContent(Stream contentStream, int length)
 {
     StreamUtils.CopyStream(contentStream, this.deflateStream, length);
 }
コード例 #3
0
 public void ReadContent(Stream destStream, int length)
 {
     StreamUtils.CopyStream(this.BaseStream, destStream, length);
 }