![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java 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
(AutoIt) Decompress Large Binary File in BlocksDecompresses a large binary file in blocks. This example uses BeginDecompressBytes, MoreDecompressBytes, and EndDecompressBytes.
; This example requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oFacSrc = ObjCreate("Chilkat_9_5_0.FileAccess") $oFacDest = ObjCreate("Chilkat_9_5_0.FileAccess") ; Open a previously compressed file for decompressing. ; See Compress Large File in Blocks Local $bSuccess = $oFacSrc.OpenForRead("qa_data/bmp/compressedBmp.dat") If ($bSuccess <> True) Then ConsoleWrite($oFacSrc.LastErrorText & @CRLF) Exit EndIf ; If we compress in 32K chunks, find out how many blocks there will be. Local $iBlockSize = 32768 Local $iNumBlocks = $oFacSrc.GetNumBlocks($iBlockSize) ; Open an output file for the decompressed data. $bSuccess = $oFacDest.OpenForWrite("qa_output/decompressed.bmp") If ($bSuccess <> True) Then ConsoleWrite($oFacDest.LastErrorText & @CRLF) Exit EndIf $oCompress = ObjCreate("Chilkat_9_5_0.Compression") $oCompress.Algorithm = "deflate" Local $oDecompressedBytes Local $oCompressedBytes Local $i = 0 While $i < $iNumBlocks $oCompressedBytes = $oFacSrc.ReadBlock($i,$iBlockSize) If ($i = 0) Then $oDecompressedBytes = $oCompress.BeginDecompressBytes($oCompressedBytes) Else $oDecompressedBytes = $oCompress.MoreDecompressBytes($oCompressedBytes) EndIf $oFacDest.FileWrite($oDecompressedBytes) $i = $i + 1 Wend ; At the very end, flush any remaining decompressed bytes, if any. $oDecompressedBytes = $oCompress.EndDecompressBytes() $oFacDest.FileWrite($oDecompressedBytes) $oFacSrc.FileClose $oFacDest.FileClose ConsoleWrite("Finished decompressing file." & @CRLF) |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.