Skip to content

zlib.ZStream.Constructor

Andrew Lambert edited this page Mar 21, 2017 · 22 revisions

zlib.ZStream.Constructor

Method Signatures

 Sub Constructor(Source As MemoryBlock,  CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, CompressionStrategy As Integer = zlib.Z_DEFAULT_STRATEGY, Encoding As Integer = zlib.Z_DETECT, MemoryLevel As Integer = zlib.DEFAULT_MEM_LVL)
 Sub Constructor(Source As BinaryStream, CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, CompressionStrategy As Integer = zlib.Z_DEFAULT_STRATEGY, Encoding As Integer = zlib.Z_DETECT, MemoryLevel As Integer = zlib.DEFAULT_MEM_LVL)

Parameters

Name Type Comment
Source MemoryBlock, BinaryStream A zero-length MemoryBlock or BinaryStream to use for output, or a >0 length MemoryBlock or BinaryStream to use for input
CompressionLevel Integer Optional. The compression level for the output. Valid levels are 1(fast) to 9(best)
CompressionStrategy Integer Optional. The compression strategy for the output.
Encoding Integer Optional. The type of compression.
MemoryLevel Integer Optional. The memory level.

Notes

Constructs a ZStream from the Source MemoryBlock or BinaryStream. If the Source MemoryBlock has a Size of zero, or as a BinaryStream its Length is equal to its position, then compressed data will be written to the Source; otherwise, the Source will be used as input to be decompressed.

Example

This example creates a ZStream from a zero-length MemoryBlock and writes(compresses) as string into it, then it creates a second ZStream for reading the compressed string:

  Dim data As New MemoryBlock(0)
  Dim z As New zlib.ZStream(data)
  z.Write("Hello, world!")
  z.Close
  z = New zlib.ZStream(data)
  MsgBox(z.ReadAll)

Entry-level points of interest denoted by "☜"



Clone this wiki locally