Xceed Binary Encoding Library Documentation
Examples / Encoding entirely in memory (Delphi example)
In This Topic
    Encoding entirely in memory (Delphi example)
    In This Topic
    Delphi Copy Code

    { This sample encodes data in memory with the Base64 encoding format } 

    uses XceedBinaryEncodingLib_TLB 

    var
      xBinEncode : TXceedBinaryEncoding; 
      xBase64Format : XceedBase64EncodingFormat; 
      vaSource : OleVariant; 
      vaEncoded : OleVariant; 
    begin
      xBinEncode := TXceedBinaryEncoding.Create( self ); 
      xBinEncode.License( 'your license key' ); 

      xBase64Format := CoXceedBase64EncodingFormat.Create();  

      xBinEncode.EncodingFormat := xBase64Format; 

      vaSource := 'This is the data to encode!';  

      try 
        vaEncoded := xBinEncode.Encode( vaSource, true ); 

        ShowMessage( 'Data encoded successfully!' ); 
      except 
        on xErr : Exception do 
          ShowMessage( xErr.Message ); 
      end; 

      xBinEncode.Free(); 
    end;