GZipOutputStream Class

SharpZip Compression Library

SharpZip Compression 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;

class MainClass
{
    public static void Main(string[] args)
    {
        Stream s = new GZipOutputStream(File.Create(args[0] + ".gz"));
        FileStream fs = File.OpenRead(args[0]);
        byte[] writeData = new byte[fs.Length];
        fs.Read(writeData, 0, (int)fs.Length);
        s.Write(writeData, 0, writeData.Length);
        s.Close();
    }
}    

Requirements

Namespace: ICSharpCode.SharpZipLib.GZip

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

See Also

GZipOutputStream Members | ICSharpCode.SharpZipLib.GZip Namespace