GetCompressionStream Method

Creates an output stream used to write compressed data.

Syntax

public System.IO.Stream GetCompressionStream(System.IO.Stream baseStream);
Public Function GetCompressionStream(ByVal BaseStream As System.IO.Stream) As System.IO.Stream

Remarks

GetCompressionStream returns a System.IO.Stream used to compress data as it is written to an underlying stream. The BaseStream parameter should be the System.IO.Stream to which the compressed data will be written.

The format (zlib or gzip) is selected with the StreamFormat property; zlib is the default.

The return value provides the following standard System.IO.Stream methods. Please see the official .NET Framework documentation for details.

public bool CanWrite { get }

Returns true.

public void Close()

Closes the stream. Also closes BaseStream if CloseBaseStream is set to true before this stream is created.

public void Flush()

Flushes the output stream, and forces all data to be compressed and written to the underlying stream. Caution: Flush only when necessary, as repeated flushing may degrade the compression ratio.

public void WriteByte(byte b)

Compresses and writes the byte b to the underlying stream.

public void Write(byte[] b, int off, int len)

Compresses and writes the byte array b to the underlying stream.

Other System.IO.Stream methods will throw a NotSupportedException.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks ZIP 2020 .NET Edition - Version 20.0 [Build 8300]