-
-
Notifications
You must be signed in to change notification settings - Fork 3
zlib.Deflate
Andrew Lambert edited this page Nov 26, 2022
·
17 revisions
zlib.Deflate
Protected Function Deflate(Source As FolderItem, Destination As FolderItem, CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, Overwrite As Boolean = False, Encoding As Integer = zlib.DEFLATE_ENCODING) As Boolean
Protected Function Deflate(Source As FolderItem, Destination As Writeable, CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, Encoding As Integer = zlib.DEFLATE_ENCODING) As Boolean
Protected Function Deflate(Source As MemoryBlock, Destination As FolderItem, CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, Overwrite As Boolean = False, Encoding As Integer = zlib.DEFLATE_ENCODING) As Boolean
Protected Function Deflate(Source As MemoryBlock, Destination As Writeable, CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, Encoding As Integer = zlib.DEFLATE_ENCODING) As Boolean
Protected Function Deflate(Source As Readable, Destination As FolderItem, CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, Overwrite As Boolean = False, Encoding As Integer = zlib.DEFLATE_ENCODING) As Boolean
Protected Function Deflate(Source As Readable, Destination As Writeable, CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, Encoding As Integer = zlib.DEFLATE_ENCODING) As Boolean
Protected Function Deflate(Source As FolderItem, CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, Encoding As Integer = zlib.DEFLATE_ENCODING) As MemoryBlock
Protected Function Deflate(Source As MemoryBlock, CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, Encoding As Integer = zlib.DEFLATE_ENCODING) As MemoryBlock
Protected Function Deflate(Source As Readable, CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, Encoding As Integer = zlib.DEFLATE_ENCODING) As MemoryBlock
Name | Type | Comment |
---|---|---|
Source |
FolderItem , Readable , or MemoryBlock
|
The data to compress |
Destination |
FolderItem or Writeable
|
The file or stream to which compressed data should be written. Methods which return a MemoryBlock do not have this parameter |
CompressionLevel | Integer |
Optional. If specified, the compression level to use (0=none, 1=fast, 9=best) |
Overwrite | Boolean |
Optional. If True , the Destination FolderItem will be overwritten if it exists. Only those methods with FolderItem destinations have this parameter |
Encoding | Integer |
Optional. If specified, the output encoding to be used by the compressor |
Returns True
if there were no errors writing to a Writeable
or FolderItem; or, a MemoryBlock
containing the compressed data.
Compresses data from the Source
argument into the Destination
argument; methods without a Destination
argument return the compressed data instead.
Compress a string into a string:
Dim data As String = "hello, world!"
Dim deflated As String = zlib.Deflate(data)
Compress a string into a file:
Dim data As String = "hello, world!"
Dim deflated As FolderItem = SpecialFolder.Desktop.Child("example.bin")
If Not zlib.Deflate(data, deflated) Then
MsgBox("Deflate error!")
End If
Compress a file into a string:
Dim data As FolderItem = SpecialFolder.Desktop.Child("example.bin")
Dim deflated As String = zlib.Deflate(data)
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.