public object Clone() { ZipEntry entry = (ZipEntry) base.MemberwiseClone(); if (this.extra != null) { entry.extra = new byte[this.extra.Length]; Array.Copy(this.extra, 0, entry.extra, 0, this.extra.Length); } return entry; }
4.ZipOutputStream类Write():Write(byte[] buffer, int offset, int count) { if (this.curEntry == null) { ); } if (buffer == null) { ); } if (offset < 0) { , ); } if (count < 0) { , ); } if ((buffer.Length - offset) < count) { ); } this.crc.Update(buffer, offset, count); this.size += count; switch (this.curMethod) { case CompressionMethod.Stored: if (base.Password != null) { this.CopyAndEncrypt(buffer, offset, count); } else { base.baseOutputStream_.Write(buffer, offset, count); } break; case CompressionMethod.Deflated: base.Write(buffer, offset, count); break; } }
三.SharpZipLib实例: 1.压缩单个文件: