Visual Basic (Declaration) | |
---|---|
Public Class GZipStream Inherits System.IO.Stream Implements System.IDisposable |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As GZipStream |
C# | |
---|---|
public class GZipStream : System.IO.Stream, System.IDisposable |
C++/CLI | |
---|---|
public ref class GZipStream : public System.IO.Stream, System.IDisposable |
The GZipStream
is a Decorator on a System.IO.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.
System.Object
System.MarshalByRefObject
System.IO.Stream
Ionic.Zlib.GZipStream
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family