ZipInputStream Class

This is a FilterInputStream that reads the files baseInputStream an zip archive one after another. It has a special method to get the zip entry of the next file. The zip entry contains information about the file name size, compressed size, CRC, etc. It includes support for STORED and DEFLATED entries. author of the original java version : Jochen Hoenicke

For a list of all members of this type, see ZipInputStream Members.

System.Object
   MarshalByRefObject
      Stream
         InflaterInputStream
            ZipInputStream

[Visual Basic]
Public Class ZipInputStream
   Inherits InflaterInputStream
   Implements IDisposable
[C#]
public class ZipInputStream : InflaterInputStream, IDisposable

Example

This sample shows how to read a zip file

            using System;
            using System.Text;
            using System.IO;
            
            using NZlib.Zip;
            
            class MainClass
            {
            	public static void Main(string[] args)
            	{
            		ZipInputStream s = new ZipInputStream(File.OpenRead(args[0]));
            		
            		ZipEntry theEntry;
            		while ((theEntry = s.GetNextEntry()) != null) {
            			Console.WriteLine("File " + theEntry.Name);
            			int size = 2048;
            			byte[] data = new byte[2048];
            			
            			Console.Write("Show contents (y/n) ?");
            			if (Console.ReadLine() == "y") {
            				while (true) {
            					size = s.Read(data, 0, data.Length);
            					if (size > 0) {
            						Console.Write(new ASCIIEncoding().GetString(data, 0, size));
            					} else {
            						break;
            					}
            				}
            			}
            			Console.WriteLine();
            		}
            		s.Close();
            	}
            }	
            

Requirements

Namespace: ICSharpCode.SharpZipLib.Zip Namespace

Assembly: SharpZipLib.dll

See Also

ZipInputStream Members | ICSharpCode.SharpZipLib.Zip Namespace