zoukankan      html  css  js  c++  java
  • webservices传base64字串

    function CompressStrToBase64(sStr: string): string;
    var
      M1: TMemoryStream;
      M0, M2: TStringStream;
    begin
      Result := '';
      if sStr = '' then
        Exit;
      M0 := TStringStream.Create(sStr);
      M1 := TMemoryStream.Create;
      M2 := TStringStream.Create(' ');
      try
        M0.Position := 0;
        M1.Position := 0;
        ZCompressStream(M0, M1);
        M1.Position := 0;
        M2.Position := 0;
        EncodeStream(M1, M2);
        Result := M2.DataString;
      finally
        FreeAndNil(M0);
        FreeAndNil(M1);
        FreeAndNil(M2);
      end;
    end;

    function DeCompressBase64ToStr(sStr: string): string;
    var
      M0, M1: TStringStream;
      M2: TMemoryStream;
    begin
      Result := '';
      if sStr = '' then
        Exit;
      M0 := TStringStream.Create('');
      M1 := TStringStream.Create(sStr);
      M2 := TMemoryStream.Create;
      try
        M1.Position := 0;
        M2.Position := 0;
        DeCodeStream(M1, M2);
        M0.Position := 0;
        M2.Position := 0;
        ZDecompressStream(M2, M0);
        Result := M0.DataString;
      finally
        FreeAndNil(M0);
        FreeAndNil(M2);
        FreeAndNil(M1);
      end;
    end;

  • 相关阅读:
    Java Web
    对象拷贝
    多线程
    容器
    新鲜出炉一份Java面试清单,共200+道题
    优秀博客
    【安防】自动光圈控制
    【硬件】变压器的电特性参数
    【工作总结】IPD开发管理流程
    【EMC】EMI滤波器
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/2743186.html
Copyright © 2011-2022 走看看