This is a FilterOutputStream that writes the files into a zip archive one after another. It has a special method to start a new zip entry. The zip entries contains information about the file name size, compressed size, CRC, etc. It includes support for STORED and DEFLATED entries. This class is not thread safe. author of the original java version : Jochen Hoenicke
For a list of all members of this type, see ZipOutputStream Members.
System.Object
   MarshalByRefObject
      Stream
         DeflaterOutputStream
            ZipOutputStream
[Visual Basic]
Public Class ZipOutputStream
   Inherits DeflaterOutputStream
   Implements IDisposable
[C#]
public class ZipOutputStream : DeflaterOutputStream, IDisposable
Example
This sample shows how to create a zip file
using System; using System.IO; using NZlib.Zip; class MainClass { public static void Main(string[] args) { string[] filenames = Directory.GetFiles(args[0]); ZipOutputStream s = new ZipOutputStream(File.Create(args[1])); s.SetLevel(5); // 0 - store only to 9 - means best compression foreach (string file in filenames) { FileStream fs = File.OpenRead(file); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); ZipEntry entry = new ZipEntry(file); s.PutNextEntry(entry); s.Write(buffer, 0, buffer.Length); } s.Finish(); s.Close(); } }
Requirements
Namespace: ICSharpCode.SharpZipLib.Zip Namespace
Assembly: SharpZipLib.dll
See Also
ZipOutputStream Members | ICSharpCode.SharpZipLib.Zip Namespace