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
Implements
Inherited Members
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 SourceGZipInputStream(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) |
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 Sourcecrc
CRC-32 value for uncompressed data
Declaration
protected Crc32 crc
Field Value
Type | Description |
---|---|
Crc32 |
Methods
| Improve this Doc View SourceGetFilename()
Retrieves the filename header field for the block last read
Declaration
public string GetFilename()
Returns
Type | Description |
---|---|
System.String |
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. |