-
-
Notifications
You must be signed in to change notification settings - Fork 3
zlib.ZStream.Constructor
Andrew Lambert edited this page Mar 21, 2017
·
22 revisions
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)
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. |
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.
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)
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2014-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.