GZipOutputStream Class

IC Sharp Sharp Zip Lib

ICSharpCode SharpZipLib Class Library

GZipOutputStream Class

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

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

System.Object    System.MarshalByRefObject
      System.IO.Stream
         ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream
            ICSharpCode.SharpZipLib.GZip.GZipOutputStream

public class GZipOutputStream : DeflaterOutputStream

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 gzip a file

using System;
using System.IO;

using ICSharpCode.SharpZipLib.GZip;
using ICSharpCode.SharpZipLib.Core;

class MainClass
{
    public static void Main(string[] args)
    {
            using (Stream s = new GZipOutputStream(File.Create(args[0] + ".gz")))
            using (FileStream fs = File.OpenRead(args[0])) {
                byte[] writeData = new byte[4096];
                Streamutils.Copy(s, fs, writeData);
            }
        }
    }
}    

Requirements

Namespace: ICSharpCode.SharpZipLib.GZip

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

See Also

GZipOutputStream Members | ICSharpCode.SharpZipLib.GZip Namespace