The TIdComproessorZLib component is used for compression and decompression in the Indy Delphi / C ++ Builder library. The CompressStream method has the following definition:
public: virtual __fastcall CompressStream(TStream AInStream, TStream AOutStream, const TIdCompressionLevel ALevel, const int AWindowBits, const int AMemLevel, const int AStrategy);
A full description of these options in the help file:
CompressStream is a publicly overridden procedure. which implements an abstract virtual method declared in an ancestor class.
AInStream is a stream containing uncompressed content used in a compression operation.
AOutStream is a stream used to store compressed content from a compression operation. AOutStream is flushed before outputting the compressed content from the operation. When AOutStream is omitted, the stream in AInStream is cleared and reused to exit the compression operation.
Use ALevel to specify the desired compression level for the operation.
Use AWindowsBits and AMemLevel to manage the memory required for in-memory compression using the ZLib library.
Use AStrategy to control the RLE coding strategy used in the compression operation.
The ALevel values โโare defined on the help page for TIdCompressionLevel, but I cannot find any indication of which values โโshould be used for AWindowBits, AMemLevel, or AStrategy, which are integers.
I looked at the source code, but CompressStream simply delegates to IndyCompressStream, which is listed in the help file as:
IndyCompressStream(TStream InStream, TStream OutStream, const int level = Z_DEFAULT_COMPRESSION, const int WinBits = MAX_WBITS, const int MemLevel = MAX_MEM_LEVEL, const int Stratagy = Z_DEFAULT_STRATEGY);
The Help for IndyCompressStream does not even list the minimum description of the parameters that CompressStream performs.
I looked at the file where (I think) these default constants mentioned in IndyCompressStream live, source \ Indy10 \ Protocols \ IdZLibHeaders.pas, and they
Z_DEFAULT_STRATEGY = 0; Z_DEFAULT_COMPRESSION = -1; MAX_WBITS = 15; { 32K LZ77 window } MAX_MEM_LEVEL = 9;
However, the value specified for Z_DEFAULT_COMPRESSION is not even a legal value for this parameter, according to the documentation for TIdCompressionLevel
Is there some kind of documentation somewhere about what AWindowBits, AMemLevel and AStrategy mean for this component and what values โโare reasonable to use for them? Are the values โโabove the actual recommended defaults? In addition, the source files include the indy, indy10 and indyimpl directories. Which one should we use to find the source for the current Indy components?
Thanks!