This is an InflaterInputStream 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
System.MarshalByRefObject
System.IO.Stream
ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream
ICSharpCode.SharpZipLib.Zip.ZipInputStream
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
Example
This sample shows how to read a zip file
[C#]
using System;
using System.Text;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
class MainClass
{
public static void Main(string[] args)
{
using ( ZipInputStream s = new ZipInputStream(File.OpenRead(args[0]))) {
ZipEntry theEntry;
while ((theEntry = s.GetNextEntry()) != null) {
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;
}
}
}
}
}
}
}
Requirements
Namespace: ICSharpCode.SharpZipLib.Zip
Assembly: ICSharpCode.SharpZipLib (in ICSharpCode.SharpZipLib.dll)
See Also
ZipInputStream Members | ICSharpCode.SharpZipLib.Zip Namespace