VB example Visual C++ example Delphi example
The ProcessFile method can compress or decompress or data from one file to another.
Parameter | Description |
---|---|
sSourceFilename | The path and filename of the source file to compress, decompress or compute the checksum of. |
lSourceOffset | The starting offset in the source file to begin processing data from. Specify 0 to begin processing data from the beginning of the file. |
lSourceSize | The amount of data to process. Specify 0 to process data from the starting offset until the end of the file. |
eAction | The type of processing that should be performed. Specify cfpCompress to compress data. For the ProcessFile method, you cannot set this parameter to cfpCalculateCRC32 or cfpCalculareAdler32. |
bEndOfData | Determines whether or not the source data to process is the final (or the only) portion of data to process. Specify True if the source data should be completely compressed or decompressed and written to the destination file. If the data to process is split apart in various sections of the same file, or in various files, then you can specify False in this parameter until all the source data has been processed. You can specify True for the last portion of data (which can be 0 bytes long) so that the library knows it must finish processing all the provided source data and flush its buffers to the destination file. When specifying False, the library will expect you to call the ProcessFile method again later with either a new source filename and/or source offset and/or source size. |
sDestFilename | The path and filename of the file to write the compressed or decompressed data to. If the file does not already exist, it will be created and written to. If the file already exists, the library can either clear the file and write to it as a new file, or it can append the processed data to the end of the destination file. |
bAppend | Determines the behavior of the library when the destination file already exists. Specify True to append to an existing file, or False to clear the file and write processed data to it as a new file. |
vaBytesRead | You must provide a variable in this parameter. Right before the ProcessFile method completes and returns, the library will write to the variable the amount of bytes read and processed from the source file. |
When compressing or decompressing a file, returns a long integer indicating the amount of bytes written to the destination file. When calculating a checksum, returns a long integer containing the data's computed checksum.
Set the CompressionFormat property to specify the format of the to process. This affects the choice of compression algorithm that will be used by the library.
When calling the ProcessFile method with the bEndOfData parameter specified as False, you cannot call any other Xceed Streaming Compression control method (of the same instance of the control) until you have completed processing a stream of data by calling the ProcessFile method with the bEndOfData parameter specified as True.
In addition to supporting regular single-file GZip files, the ReadFile and ProcessFile methods also support multi-file GZ archives (not TAR files) which contain multiple header/data/footer sections. Though the GZip format was not designed to append multiple files, such GZ files are circulating.
If dwSourceSize is greater than 0, and dwBytesRead is less than dwSourceSize, this indicates that the end of the compressed data was detected. If bEndOfData isfalse, a final call to the ReadFile or ProcessFile method must be done, without any source and with bEndOfData set to true, in order to complete the process and reset the state. If dwSourceSize is equal to 0 and bEndOfData is false and dwBytesRead is less than the actual number of bytes that are available in the source file at the offset, a final call to the ReadFile or ProcessFile method must be done, without any source and bEndOfData set to true, in order to complete the process and reset the state. If bEndOfData is true, dwBytesRead will return either the detected end of compressed data or dwSourceSize if the end matched the provided size.
So with any scenario, the offset can be updated using dwBytesRead for any subsequent calls to the ReadFile or ProcessFile methods to either continue decompressing the file (bEndOfData false), or the following file in a multi-file GZ stream (bEndOfData true in the previous call).
Since the Decompress method cannot return the actual number of bytes processed out of the source data, it can decompress the compressed stream found at the specified offset, but you won't be able to update the offset for any subsequent compressed stream in the data. Thus, it is not suggested to try decompressing multi-file GZ data with the Decompress method.
Declaration (DXceedStreamingCompression) | ![]() |
---|---|
HRESULT ProcessFile |
Declaration (IXceedStreamingCompression) | ![]() |
---|---|
|