![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java JavaScript Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Add Custom Extra Data to a Gzip FileThis example demonstrates how to use the The hex string represents the raw bytes to embed in the Gzip metadata. When a compression method is called, this data is included in the Gzip header. The example also shows how to retrieve the metadata using
integer li_rc integer li_Success oleobject loo_Gzip oleobject loo_Json string ls_InputFile string ls_OutputFile li_Success = 0 // This example demonstrates how to include custom extra data // in the Gzip header when compressing. // The extra data is provided as a hex-encoded string. loo_Gzip = create oleobject li_rc = loo_Gzip.ConnectToNewObject("Chilkat.Gzip") if li_rc < 0 then destroy loo_Gzip MessageBox("Error","Connecting to COM object failed") return end if loo_Json = create oleobject li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") // Set extra data using a hex string. // This example represents 4 bytes: 00 01 02 03 li_Success = loo_Gzip.SetExtraData("00010203","hex") if li_Success = 0 then Write-Debug loo_Gzip.LastErrorText destroy loo_Gzip destroy loo_Json return end if // Compress a file so the extra data is embedded in the Gzip header: ls_InputFile = "example.txt" ls_OutputFile = "example.txt.gz" li_Success = loo_Gzip.CompressFile(ls_InputFile,ls_OutputFile) if li_Success = 0 then Write-Debug loo_Gzip.LastErrorText destroy loo_Gzip destroy loo_Json return end if Write-Debug "Gzip file created with extra data." // (Optional) Retrieve the metadata to verify: li_Success = loo_Gzip.GetGzipInfo(ls_OutputFile,loo_Json) if li_Success = 0 then Write-Debug loo_Gzip.LastErrorText destroy loo_Gzip destroy loo_Json return end if Write-Debug "Metadata JSON:" Write-Debug loo_Json.Emit() destroy loo_Gzip destroy loo_Json |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.