Skip to content
Andrew Lambert edited this page Jan 27, 2019 · 33 revisions

zlib.ZStream

Class Declaration

 Protected Class ZStream
 Implements zlib.CompressedStream

Remarks

This represents a deflate stream. Depending on the initialization options this class can read/write streams compressed using DEFLATE(with or without header/footer) or GZIP.

A ZStream has a reference to a Writeable object to which all compressed output is ultimately written; this is the "output stream". A corresponding Readable object is the ultimate source for all compressed input; this is the "input stream".

Typically, when compressing you only specify the output stream and when decompressing only the input stream. However both may be used simultaneously. This can be useful if you need to read and write both compressed and uncompressed bytes from a single stream (e.g. a zip stream), or to create one end of a (de)compressed "pipe" by using two distinct streams.

This class implements the CompressedStream, Readable, and Writeable class interfaces.

Methods

Properties

Shared Methods

Example

This example creates an in-memory compression stream by calling Constructor(MemoryBlock), and writes some data that will be compressed using GZip at maximum compression:

  Dim output As New MemoryBlock(0)
  Dim compressor As New zlib.ZStream(output, zlib.Z_BEST_COMPRESSION, zlib.Z_DEFAULT_STRATEGY, zlib.GZIP_ENCODING)
  compressor.Write("Hello, world!")
  compressor.Close

See also

Entry-level points of interest denoted by "☜"



Clone this wiki locally