zoukankan      html  css  js  c++  java
  • delphi 压缩和解压文件

    需要引入system.ZLib包

    procedure TFormMain1.Button25Click(Sender: TObject);   //压缩
    var
      LInput, LOutput: TFileStream;
      LZip: TZCompressionStream;
    begin
      inherited;
      LInput := TFileStream.Create(Edit2.Text, fmOpenRead);   //需要压缩的文件
      LOutput := TFileStream.Create(Edit3.Text + '.zip', fmCreate);  //压缩完成的文件
      LZip := TZCompressionStream.Create(LOutput);
    
      LZip.CopyFrom(LInput, LInput.Size);
    
      LZip.Free;
      LInput.Free;
      LOutput.Free;
    
    end;
    
    procedure TFormMain1.Button26Click(Sender: TObject);   //解压
    var
      LInput, LOutput: TFileStream;
      LUnZip: TZDecompressionStream;
    
    begin
      { Create the Input, Output, and Decompressed streams. }
      LInput := TFileStream.Create(Edit2.Text, fmOpenRead);  //解压的文件
      LOutput := TFileStream.Create(ChangeFileExt(Edit3.Text, '.txt'), fmCreate);  //解压后的文件
      LUnZip := TZDecompressionStream.Create(LInput);
    
      { Decompress data. }
      LOutput.CopyFrom(LUnZip, 0);
    
      { Free the streams. }
      LUnZip.Free;
      LInput.Free;
      LOutput.Free;
    end;
  • 相关阅读:
    TC79
    SQL TUNNING
    Oracle PLSQL
    DB String Split sample
    dw websites
    Load xlsx in a folder to RDBMS table with Talend
    Reading WebSites
    SQOOP Load Data from Oracle to Hive Table
    dotnet use regex two samples
    Excel scientific notation issue
  • 原文地址:https://www.cnblogs.com/yangxuming/p/11429534.html
Copyright © 2011-2022 走看看