GZipStream
using the specified CompressionMode
, and explicitly specify whether the stream should be left open after Deflation or Inflation.
Visual Basic (Declaration) | |
---|---|
Public Function New( _ ByVal stream As Stream, _ ByVal mode As CompressionMode, _ ByVal leaveOpen As Boolean _ ) |
Visual Basic (Usage) | ![]() |
---|---|
Dim stream As Stream Dim mode As CompressionMode Dim leaveOpen As Boolean Dim instance As New GZipStream(stream, mode, leaveOpen) |
Parameters
- stream
- The stream which will be read or written. This is called the "captive" stream in other places in this documentation.
- mode
- Indicates whether the GZipStream will compress or decompress.
- leaveOpen
- 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 Constructor(Stream,CompressionMode,CompressionLevel,Boolean).
See the other overloads of this constructor for example code.
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