Application of compressed flow and pressure flow in Delphi

Source: Internet
Author: User

Software developers will inevitably have to face the problem of compressed data! Often use Delphi friends know that it provides us with two flow classes (Tcompressionstream and Tdecompressionstream) to complete the compression and decompression of data, but the drawback is that the flow in Delphi Help no detailed description , making them difficult to use. In fact, in the Delphi system provides these two classes of source code and library. Stored in the Delphi CD-ROM \info\extras\zlib\ src and \info\extras\zlib\obj directory (where the obj directory is stored in the library, SRC directory to save the source code, interested friends can see). In the process of using, I have a certain understanding of them.

I. Description of the class

1, base class Tcustomzlibstream: Class Tcustomzlibstream is the class Tcompressionstream and Tdecompressionstream class base class, it has one main attribute: OnProgress, This event occurs during the process of compressing or decompressing a class, which is defined as follows:

Procedure onprogress (Sender:tobject); Dynamic

2, Compression class Tcompressionstream: Class Tcompressionstream In addition to inheriting the OnProgress attribute of the base class, but also added a property: Compressionrate, it is defined as follows:

Property Compressionrate:single read Getcompressionrate, through which the compression ratio can be obtained.

Several of its important methods are defined as follows:

Constructor Tcompressionstream.create (Compressionlevel:tcompressionlevel; Dest:tstream);

Where: Tcompressionlevel (compression type), which is defined by the following:

①, Clnone: no data compression;

②, Clfastest: Fast compression, sacrificing compression efficiency;

③, Cldefault: normal compression;

④, CLmax: To maximize compression, sacrificing speed;

Dest: Destination stream, for storing compressed data.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.