Indy 9
|
TIdCompressionIntercept = class(TIdConnectionIntercept)
In order for this file to compile on Windows, the follow .obj files *must* be provided as delivered with this file:
On Linux, the shared-object file libz.so.1 *must* be available on the system. Most modern Linux distributions include this file.
You may sometimes get the following compiler errors with this file:
IdCompressionIntercept.pas(331) Error: Incompatible types IdCompressionIntercept.pas(152) Error: Unsatisfied forward or external declaration: '_tr_init' IdCompressionIntercept.pas(153) Error: Unsatisfied forward or external declaration: '_tr_tally' IdCompressionIntercept.pas(154) Error: Unsatisfied forward or external declaration: '_tr_flush_block' IdCompressionIntercept.pas(155) Error: Unsatisfied forward or external declaration: '_tr_align' IdCompressionIntercept.pas(156) Error: Unsatisfied forward or external declaration: '_tr_stored_block' IdCompressionIntercept.pas(157) Error: Unsatisfied forward or external declaration: 'adler32' IdCompressionIntercept.pas(158) Error: Unsatisfied forward or external declaration: 'inflate_blocks_new' IdCompressionIntercept.pas(159) Error: Unsatisfied forward or external declaration: 'inflate_blocks' IdCompressionIntercept.pas(160) Error: Unsatisfied forward or external declaration: 'inflate_blocks_reset' IdCompressionIntercept.pas(161) Error: Unsatisfied forward or external declaration: 'inflate_blocks_free' IdCompressionIntercept.pas(162) Error: Unsatisfied forward or external declaration: 'inflate_set_dictionary' IdCompressionIntercept.pas(163) Error: Unsatisfied forward or external declaration: 'inflate_trees_bits' IdCompressionIntercept.pas(164) Error: Unsatisfied forward or external declaration: 'inflate_trees_dynamic' IdCompressionIntercept.pas(165) Error: Unsatisfied forward or external declaration: 'inflate_trees_fixed' IdCompressionIntercept.pas(166) Error: Unsatisfied forward or external declaration: 'inflate_trees_free' IdCompressionIntercept.pas(167) Error: Unsatisfied forward or external declaration: 'inflate_codes_new' IdCompressionIntercept.pas(168) Error: Unsatisfied forward or external declaration: 'inflate_codes' IdCompressionIntercept.pas(169) Error: Unsatisfied forward or external declaration: 'inflate_codes_free' IdCompressionIntercept.pas(170) Error: Unsatisfied forward or external declaration: '_inflate_mask' IdCompressionIntercept.pas(171) Error: Unsatisfied forward or external declaration: 'inflate_flush' IdCompressionIntercept.pas(172) Error: Unsatisfied forward or external declaration: 'inflate_fast' IdCompressionIntercept.pas(189) Error: Unsatisfied forward or external declaration: 'deflateInit_' IdCompressionIntercept.pas(196) Error: Unsatisfied forward or external declaration: 'deflate' IdCompressionIntercept.pas(203) Error: Unsatisfied forward or external declaration: 'deflateEnd' IdCompressionIntercept.pas(213) Error: Unsatisfied forward or external declaration: 'inflateInit_' IdCompressionIntercept.pas(220) Error: Unsatisfied forward or external declaration: 'inflate' IdCompressionIntercept.pas(227) Error: Unsatisfied forward or external declaration: 'inflateEnd' IdCompressionIntercept.pas(234) Error: Unsatisfied forward or external declaration: 'inflateReset' Indy40.dpk(196) Fatal: Could not compile used unit 'IdCompressionIntercept.pas'
Do not be alarmed. This is due to a bug in DCC32 in Delphi 4, 5, 6, plus C++Builder, 4, 5, and 6.
There is a workaround for this issue. The workaround is to compile this unit separately from the other units and than build Indy with a command such as DCC32 using the /M parameter. DO not use the /B parameter as that does force everything to be recompiled triggering the DCC32 error.
The batch files FULLC4.BAT, FULLC5.BAT, FULLC6.BAT, FULLD4.BAT, FULLD5.BAT and FULLD6.BAT now have the workaround in them so we recommend that you use those to build Indy.
Borland is aware of the issue.
Original Author: Allen Bauer
This source file is submitted to the Indy project on behalf of Borland Sofware Corporation. No warranties, express or implied are given with this source file.
property CompressionLevel: TCompressionLevel;
Both the sender and receiver must have compression enabled in order to properly decompress the data stream for the intercept. They do not have to use the same CompressionLevel as long as they are both set to a value between 1 and 9.
Changing the value in CompressionLevel insures that the internal compression and decompression records are reset and cleared. The new value for CompressionLevel will also be forced into the range allowed by the TCompressionLevel enumeration.
destructor Destroy; override;
procedure Receive(ABuffer: TStream); override;
Receive initializes the internal ZLib compression and decompression records when they have been assigned in the object instance. Receive reads data from the internal receive buffer using a 2,048 byte block that expands by 1024 bytes on successive reads until the end of the ZLib stream is reached. If a stream, data, or memory error occurs while decompressing the contents of the receive buffer, a EIdDecompressionError exception will be raised with the message RSZLDecompressionError.
On successful completion of receive buffer decompression, ABuffer is resized and the decompressed data is returned to the stream.
procedure Send(ABuffer: TStream); override;
Send initializes the internal ZLib compression and decompression records when they have been assigned in the object instance. Send insures that the internal Send buffer is large enough to hold the stream data in ABuffer. Send reads data from the internal send buffer using a 2,048 byte block that expands by 1024 bytes on successive reads until the end of the ZLib stream is reached.
If a stream, data, or memory error occurs while compressing the contents of the send buffer, a EIdCompressionError exception will be raised with the message RSZLCompressionError.
On successful completion of send buffer compression, ABuffer is resized and the compressed data is returned to the stream.