Xceed Streaming Compression Library Documentation
Examples / Compressing from file to memory (Delphi example)
In This Topic
    Compressing from file to memory (Delphi example)
    In This Topic
    Delphi Copy Code

    uses XceedStreamingCompressionLib_TLB 

    var
      xComp : TXceedStreamingCompression; 
      xBZip2 : DXceedBZip2CompressionFormat; 
      vaBytesRead : OleVariant; 
    begin
      xComp := TXceedStreamingCompression.Create( self ); 
      xComp.License( 'your license key' ); 

      xBZip2 := CoXceedBZip2CompressionFormat.Create();  

      xComp.CompressionFormat := xBZip2;  

      try 
        xComp.ReadFile( 'c:\temp\source.txt', 0, 0, cfpCompress, TRUE, vaBytesRead ); 
        ShowMessage( 'Compression successful!' ); 
      except 
      on xErr : Exception do 
        ShowMessage( xErr.Message ); 
      end; 

      xComp.Free(); 

    end;