GZipStream Class

DotNetZip

Ionic Zip Library v1.9.1.6 GZipStream Class
ReferenceIonic.ZlibGZipStream
A class for compressing and decompressing GZIP streams.
Declaration Syntax
C# Visual Basic Visual C++
public class GZipStream : Stream
Public Class GZipStream _
	Inherits Stream
public ref class GZipStream : public Stream
Members
All Members Constructors Methods Properties Fields



Icon Member Description
GZipStream(Stream, CompressionMode)
Create a GZipStream using the specified CompressionMode.

GZipStream(Stream, CompressionMode, CompressionLevel)
Create a GZipStream using the specified CompressionMode and the specified CompressionLevel.

GZipStream(Stream, CompressionMode, Boolean)
Create a GZipStream using the specified CompressionMode, and explicitly specify whether the stream should be left open after Deflation or Inflation.

GZipStream(Stream, CompressionMode, CompressionLevel, Boolean)
Create a GZipStream using the specified CompressionMode and the specified CompressionLevel, and explicitly specify whether the stream should be left open after Deflation or Inflation.

BeginRead(array<Byte>[]()[][], Int32, Int32, AsyncCallback, Object) HostProtectionAttribute.
Begins an asynchronous read operation.
(Inherited from Stream.)
BeginWrite(array<Byte>[]()[][], Int32, Int32, AsyncCallback, Object) HostProtectionAttribute.
Begins an asynchronous write operation.
(Inherited from Stream.)
BufferSize
The size of the working buffer for the compression codec.

CanRead
Indicates whether the stream can be read.
(Overrides Stream.CanRead.)
CanSeek
Indicates whether the stream supports Seek operations.
(Overrides Stream.CanSeek.)
CanTimeout
Gets a value that determines whether the current stream can time out.
(Inherited from Stream.)
CanWrite
Indicates whether the stream can be written.
(Overrides Stream.CanWrite.)
Close()()()()
Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream.
(Inherited from Stream.)
Comment
The comment on the GZIP stream.

CompressBuffer(array<Byte>[]()[][])
Compress a byte array into a new byte array using GZip.

CompressString(String)
Compress a string into a byte array using GZip.

Crc32
The CRC on the GZIP stream.

CreateObjRef(Type)
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
CreateWaitHandle()()()() Obsolete.
Allocates a WaitHandle object.
(Inherited from Stream.)
Dispose(Boolean)
Dispose the stream.
(Overrides Stream.Dispose(Boolean).)
Dispose()()()()
Releases all resources used by the Stream.
(Inherited from Stream.)
EndRead(IAsyncResult)
Waits for the pending asynchronous read to complete.
(Inherited from Stream.)
EndWrite(IAsyncResult)
Ends an asynchronous write operation.
(Inherited from Stream.)
Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
FileName
The FileName for the GZIP stream.

Finalize()()()()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Flush()()()()
Flush the stream.
(Overrides Stream.Flush()()()().)
FlushMode
This property sets the flush behavior on the stream.

GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetLifetimeService()()()()
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
GetType()()()()
Gets the Type of the current instance.
(Inherited from Object.)
InitializeLifetimeService()()()()
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
LastModified
The last modified time for the GZIP stream.

Length
Reading this property always throws a NotImplementedException.
(Overrides Stream.Length.)
MemberwiseClone(Boolean)
Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject.)
MemberwiseClone()()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
Position
The position of the stream pointer.
(Overrides Stream.Position.)
Read(array<Byte>[]()[][], Int32, Int32)
Read and decompress data from the source stream.
(Overrides Stream.Read(array<Byte>[]()[][], Int32, Int32).)
ReadByte()()()()
Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
(Inherited from Stream.)
ReadTimeout
Gets or sets a value, in miliseconds, that determines how long the stream will attempt to read before timing out.
(Inherited from Stream.)
Seek(Int64, SeekOrigin)
Calling this method always throws a NotImplementedException.
(Overrides Stream.Seek(Int64, SeekOrigin).)
SetLength(Int64)
Calling this method always throws a NotImplementedException.
(Overrides Stream.SetLength(Int64).)
ToString()()()()
Returns a String that represents the current Object.
(Inherited from Object.)
TotalIn
Returns the total number of bytes input so far.

TotalOut
Returns the total number of bytes output so far.

UncompressBuffer(array<Byte>[]()[][])
Uncompress a GZip'ed byte array into a byte array.

UncompressString(array<Byte>[]()[][])
Uncompress a GZip'ed byte array into a single string.

Write(array<Byte>[]()[][], Int32, Int32)
Write data to the stream.
(Overrides Stream.Write(array<Byte>[]()[][], Int32, Int32).)
WriteByte(Byte)
Writes a byte to the current position in the stream and advances the position within the stream by one byte.
(Inherited from Stream.)
WriteTimeout
Gets or sets a value, in miliseconds, that determines how long the stream will attempt to write before timing out.
(Inherited from Stream.)
Remarks

The GZipStream is a Decorator on a Stream. It adds GZIP compression or decompression to any stream.

Like the System.IO.Compression.GZipStream in the .NET Base Class Library, the Ionic.Zlib.GZipStream can compress while writing, or decompress while reading, but not vice versa. The compression method used is GZIP, which is documented in IETF RFC 1952, "GZIP file format specification version 4.3".

A GZipStream can be used to decompress data (through Read()) or to compress data (through Write()), but not both.

If you wish to use the GZipStream to compress data, you must wrap it around a write-able stream. As you call Write() on the GZipStream, the data will be compressed into the GZIP format. If you want to decompress data, you must wrap the GZipStream around a readable stream that contains an IETF RFC 1952-compliant stream. The data will be decompressed as you call Read() on the GZipStream.

Though the GZIP format allows data from multiple files to be concatenated together, this stream handles only a single segment of GZIP format, typically representing a single file.

This class is similar to ZlibStream and DeflateStream. ZlibStream handles RFC1950-compliant streams. DeflateStream handles RFC1951-compliant streams. This class handles RFC1952-compliant streams.

Inheritance Hierarchy
Object
MarshalByRefObject
  Stream
    GZipStream

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: 1.9.1.8 (1.9.1.8)