迷你5207专属论坛

注册

 

发新话题 回复该主题

Delphi的Base64转流 及 流转Base64的方法 [复制链接]

发表者
Delphi的Base64转流 及 流转Base64的方法
  1. //Base64码转流
  2. procedure Base64ToStream(const ABase64: WideString;
  3.   AStream: TStream);
  4. var
  5.   objSS: TStringStream;
  6.   s: string;
  7. begin
  8.   if ABase64 = '' then Exit;

  9.   objSS := TStringStream.Create(ABase64);
  10.   try
  11.     DecodeStream(objSS, AStream);
  12.     AStream.Position := 0;
  13.   finally
  14.     FreeAndNil(objSS);
  15.   end;
  16. end;

  17. //流转Base64
  18. procedure StreamToBase64(AStream: TStream;
  19.   var ABase64: WideString);
  20. var
  21.   objSS: TStringStream;
  22. begin
  23.   objSS := TStringStream.Create('');
  24.   try
  25.     EncodeStream(AStream, objSS);
  26.     ABase64 := objSS.DataString;
  27.   finally
  28.     FreeAndNil(objSS);
  29.   end;
  30. end;
复制代码
本主题由 皇帝 5207 于 2009-7-3 22:59:21 执行 主题分类 操作
分享 转发
相信与不相信都是矛盾的.  5207宣!欢迎您来到点滴论坛
TOP
发新话题 回复该主题