DecompressBlock Method

Decompresses a block of data.

Syntax

ANSI (Cross Platform)
int DecompressBlock();

Unicode (Windows)
INT DecompressBlock();
- (void)decompressBlock;
#define MID_ZIPSTREAM_DECOMPRESSBLOCK 5

IPWORKSZIP_EXTERNAL int IPWORKSZIP_CALL IPWorksZip_ZipStream_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

This method decompresses the block of data specified by InputData.

The CompressBlock and DecompressBlock methods operate on blocks (chunks) of data. The methods may be used to compress and decompress data as it becomes available.

Note that when using blocks of data the OutputData property is not applicable. Instead data is made available through the CompressedData and DecompressedData events.

If all data is available ahead of time CompressData and DecompressData may be called instead.

Compress Data

Set InputData to the current block to be compressed. Next call CompressBlock to compress the current block. Note that CompressBlock takes a LastBlock parameter. If the block of data is the final block to be compressed set this to True. For all other blocks set this to False.

During compression the CompressedData event will fire with the compressed data. Note that this event may not fire for every call to CompressBlock due to the way the compression algorithm operates. For example:


zipstream.InputDataB = MyDecompressedData;
zipstream.CompressBlock();
Data is accumulated inside the CompressedData event:
private static void Zipstream_OnCompressedData(object sender, ZipstreamCompressedDataEventArgs e)
{
  DoSomethingWith(e.DataB);
}

Note that OutputData is not applicable when compressing block data.

Decompress Data

Set InputData to the current block to be decompressed. Next call DecompressBlock to decompress the current block.

During decompression the DecompressedData event will fire with the decompressed data. Note that this event may not fire for every call to DecompressBlock due to the way the decompression algorithm operates. For example:


zipstream.InputDataB = MyCompressedData;
zipstream.DecompressBlock();
Data is accumulated inside the DecompressedData event:
private static void Zipstream_OnDecompressedData(object sender, ZipstreamDecompressedDataEventArgs e)
{
  DoSomethingWith(e.DataB);
}

Note that OutputData is not applicable when decompressing block data.

Error Handling (C++)

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks ZIP 2020 C++ Edition - Version 20.0 [Build 8300]