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

    uses XceedStreamingCompressionLib_TLB 

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

      xBZip2 := CoXceedBZip2CompressionFormat.Create();  

      xComp.CompressionFormat := xBZip2; 
      vaData := 'This is the data to compress compress compress';  

     try 
        xComp.WriteFile( vaData, cfpCompress, True, 'c:\temp\compressed.cmp', false ); 
        ShowMessage( 'Compression successful!' ); 
      except 
        on xErr : Exception do 
          ShowMessage( xErr.Message ); 
      end; 
      xComp.Free(); 

    end;