C# | Visual Basic | Visual C++ |
public GZipStream( Stream stream, CompressionMode mode, bool leaveOpen )
Public Sub New ( _ stream As Stream, _ mode As CompressionMode, _ leaveOpen As Boolean _ )
public: GZipStream( Stream^ stream, CompressionMode mode, bool leaveOpen )
- stream (Stream)
- The stream which will be read or written. This is called the "captive" stream in other places in this documentation.
- mode (CompressionMode)
- Indicates whether the GZipStream will compress or decompress.
- leaveOpen (Boolean)
- true if the application would like the base stream to remain open after inflation/deflation.
This constructor allows the application to request that the captive stream remain open after the deflation or inflation occurs. By default, after Close() is called on the stream, the captive stream is also closed. In some cases this is not desired, for example if the stream is a memory stream that will be re-read after compressed data has been written to it. Specify true for the leaveOpen parameter to leave the stream open.
The CompressionMode (Compress or Decompress) also establishes the "direction" of the stream. A GZipStream with CompressionMode.Compress works only through Write(). A GZipStream with CompressionMode.Decompress works only through Read().
The GZipStream will use the default compression level. If you want to specify the compression level, see GZipStream(Stream, CompressionMode, CompressionLevel, Boolean).
See the other overloads of this constructor for example code.