Show / Hide Table of Contents

Class GZipInputStream

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

Inheritance
System.Object
System.MarshalByRefObject
System.IO.Stream
InflaterInputStream
GZipInputStream
Implements
System.IDisposable
Inherited Members
InflaterInputStream.IsStreamOwner
InflaterInputStream.Skip(Int64)
InflaterInputStream.StopDecrypting()
InflaterInputStream.Available
InflaterInputStream.Fill()
InflaterInputStream.CanRead
InflaterInputStream.CanSeek
InflaterInputStream.CanWrite
InflaterInputStream.Length
InflaterInputStream.Position
InflaterInputStream.Flush()
InflaterInputStream.Seek(Int64, SeekOrigin)
InflaterInputStream.SetLength(Int64)
InflaterInputStream.Write(Byte[], Int32, Int32)
InflaterInputStream.WriteByte(Byte)
InflaterInputStream.Dispose(Boolean)
InflaterInputStream.inf
InflaterInputStream.inputBuffer
InflaterInputStream.csize
System.IO.Stream.Null
System.IO.Stream.BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.Close()
System.IO.Stream.CopyTo(System.IO.Stream)
System.IO.Stream.CopyTo(System.IO.Stream, System.Int32)
System.IO.Stream.CopyToAsync(System.IO.Stream)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.CreateWaitHandle()
System.IO.Stream.Dispose()
System.IO.Stream.EndRead(System.IAsyncResult)
System.IO.Stream.EndWrite(System.IAsyncResult)
System.IO.Stream.FlushAsync()
System.IO.Stream.FlushAsync(System.Threading.CancellationToken)
System.IO.Stream.ObjectInvariant()
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.ReadByte()
System.IO.Stream.Synchronized(System.IO.Stream)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.CanTimeout
System.IO.Stream.ReadTimeout
System.IO.Stream.WriteTimeout
System.MarshalByRefObject.GetLifetimeService()
System.MarshalByRefObject.InitializeLifetimeService()
System.MarshalByRefObject.MemberwiseClone(System.Boolean)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ICSharpCode.SharpZipLib.GZip
Assembly: ICSharpCode.SharpZipLib.dll
Syntax
public class GZipInputStream : InflaterInputStream, IDisposable
Examples

This sample shows how to unzip a gzipped file

using System;
using System.IO;

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

class MainClass
{
    public static void Main(string[] args)
    {
        using (Stream inStream = new GZipInputStream(File.OpenRead(args[0])))
        using (FileStream outStream = File.Create(Path.GetFileNameWithoutExtension(args[0]))) {
            byte[] buffer = new byte[4096];
            StreamUtils.Copy(inStream, outStream, buffer);
        }
    }
}

Constructors

| Improve this Doc View Source

GZipInputStream(Stream)

Creates a GZipInputStream with the default buffer size

Declaration
public GZipInputStream(Stream baseInputStream)
Parameters
Type Name Description
System.IO.Stream baseInputStream

The stream to read compressed data from (baseInputStream GZIP format)

| Improve this Doc View Source

GZipInputStream(Stream, Int32)

Creates a GZIPInputStream with the specified buffer size

Declaration
public GZipInputStream(Stream baseInputStream, int size)
Parameters
Type Name Description
System.IO.Stream baseInputStream

The stream to read compressed data from (baseInputStream GZIP format)

System.Int32 size

Size of the buffer to use

Fields

| Improve this Doc View Source

crc

CRC-32 value for uncompressed data

Declaration
protected Crc32 crc
Field Value
Type Description
Crc32

Methods

| Improve this Doc View Source

GetFilename()

Retrieves the filename header field for the block last read

Declaration
public string GetFilename()
Returns
Type Description
System.String
| Improve this Doc View Source

Read(Byte[], Int32, Int32)

Reads uncompressed data into an array of bytes

Declaration
public override int Read(byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to read uncompressed data into

System.Int32 offset

The offset indicating where the data should be placed

System.Int32 count

The number of uncompressed bytes to be read

Returns
Type Description
System.Int32

Returns the number of bytes actually read.

Overrides
InflaterInputStream.Read(Byte[], Int32, Int32)

Implements

System.IDisposable
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2000-2022 SharpZipLib Contributors