GZipInputStream Class

SharpZip Compression Library

SharpZip Compression Library

GZipInputStream Class

This filter stream is used to decompress a "GZIP" format stream. The "GZIP" format is described baseInputStream RFC 1952. author of the original java version : John Leuner

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

System.Object    System.MarshalByRefObject
      System.IO.Stream
         ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream
            ICSharpCode.SharpZipLib.GZip.GZipInputStream

public class GZipInputStream : InflaterInputStream

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 unzip a gzipped file

using System;
using System.IO;

using ICSharpCode.SharpZipLib.GZip;

class MainClass
{
    public static void Main(string[] args)
    {
        Stream s = new GZipInputStream(File.OpenRead(args[0]));
        FileStream fs = File.Create(Path.GetFileNameWithoutExtension(args[0]));
        int size = 2048;
        byte[] writeData = new byte[2048];
        while (true) {
            size = s.Read(writeData, 0, size);
            if (size > 0) {
                fs.Write(writeData, 0, size);
            } else {
                break;
            }
        }
        s.Close();
    }
}    

Requirements

Namespace: ICSharpCode.SharpZipLib.GZip

Assembly: ICSharpCode.SharpZipLib (in ICSharpCode.SharpZipLib.dll)

See Also

GZipInputStream Members | ICSharpCode.SharpZipLib.GZip Namespace