Delphi Database, Delphi Components from ComponentAce
Products Download Order Contact us
/img/help/home.gif /img/help/prev.gif /img/help/next.gif

 

Compressing a file to file

 


 

Easy Compression Library provides a file stream interface with TECLFileStream class that can be easily used to compress and decompress a file to file.

 

Compressing a file to file.

To compress a file to file you need to perform the following 3 steps:

  1. Create an instance of TECLFileStream for the destination compressed file with blank Password and with CompressionLevel parameter not equal to eclNone value, i.e. with one of the compression modes.
  2. Call LoadFromFile method of TECLFileStream to load and compress source file.
  3. Free the TECLFileStream object to close compressed file.
  4.  

    Example:

    var

    CompFS: TECLFileStream;

    begin

    CompFS := TECLFileStream.Create('c:\test_comp.ecl', fmCreate, '', zlibFastest);

    CompFS.LoadFromFile('c:\test.txt');

    CompFS.Free;

    end;

     

    Decompressing a file to file.

    To decompress a file to file you need to perform the following 3 steps:

    1. Create an instance of TECLFileStream for the source compressed file with two parameters in constructor: FileName and Mode.
    2. Call SaveToFile method of TECLFileStream to decompress data and save to the destination file.
    3. Free the TECLFileStream object to close compressed file.
    4.  

      Example:

      var

      CompFS: TECLFileStream;

      begin

      CompFS := TECLFileStream.Create('c:\test_comp.ecl', fmOpenRead or fmShareDenyNone);

      CompFS.SaveToFile('c:\test_decomp.txt');

      CompFS.Free;

      end;

       

        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Dec 03, 2024