System.ZLib.ZCompress
Delphi
procedure ZCompress(const inBuffer: Pointer; inSize: Integer; out outBuffer: Pointer; out outSize: Integer; level: TZCompressionLevel);
procedure ZCompress(const inBuffer: Pointer; inSize: Integer; out outBuffer: Pointer; out outSize: Integer; level: TCompressionLevel);
procedure ZCompress(const inBuffer: TBytes; out outBuffer: TBytes; level: TZCompressionLevel);
C++
extern DELPHI_PACKAGE void __fastcall ZCompress(const void * inBuffer, int inSize, /* out */ void * &outBuffer, /* out */ int &outSize, TZCompressionLevel level = (TZCompressionLevel)(0x2))/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | System.ZLib.pas System.ZLib.hpp |
System.ZLib | System.ZLib |
Description
ZCompress compresses a source buffer into a destination buffer.
It compresses the buffer specified by inBuffer
into the buffer specified by outBuffer
.
inSize
represents the size (in bytes) of inBuffer
. outBuffer
must not be initialized. The level
optional parameter represents the level of compression. The function can be called without the level
parameter. In this case, level
is set to the default value: zcDefault
.
The function call modifies the outBuffer
and outSize
parameters. outBuffer
points to the compressed data and outSize
will represent the size (in bytes) of the compressed data.
ZCompress may raise an EZCompressionError.
See sample:
function myCompress(mySource: array of byte): Pointer;
var
destinationSize, sourceLen: integer;
outPut: Pointer;
Source: PByte;
begin
Source := @mySource[0];
sourceLen := Length(mySource);
ZCompress(Source, sourceLen, outPut, destinationSize, zcDefault);
Result := outPut;
end;