• INDY10 BASE64编码


    INDY10 BASE64编码

    DELPHI自带的BASE64单元,在项目中使用发现非常没有效率,INDY10的好用。

    uses IdCoderMIME

    BASE64编码类:TIdEncoderMIME

    BASE64编码接口

    type
      TIdEncoder = class(TIdBaseComponent)
      public
        function Encode(const AIn: string; AByteEncoding: IIdTextEncoding = nil
          {$IFDEF STRING_IS_ANSI}; ASrcEncoding: IIdTextEncoding = nil{$ENDIF}
          ): string; overload;
        procedure Encode(const AIn: string; ADestStrings: TStrings; AByteEncoding: IIdTextEncoding = nil
          {$IFDEF STRING_IS_ANSI}; ASrcEncoding: IIdTextEncoding = nil{$ENDIF}
          ); overload;
        procedure Encode(const AIn: string; ADestStream: TStream; AByteEncoding: IIdTextEncoding = nil
          {$IFDEF STRING_IS_ANSI}; ASrcEncoding: IIdTextEncoding = nil{$ENDIF}
          ); overload;
    
        function Encode(ASrcStream: TStream; const ABytes: Integer = -1): string; overload;
        procedure Encode(ASrcStream: TStream; ADestStrings: TStrings; const ABytes: Integer = -1); overload;
        procedure Encode(ASrcStream: TStream; ADestStream: TStream; const ABytes: Integer = -1); overload; virtual; abstract;
    
        class function EncodeString(const AIn: string; AByteEncoding: IIdTextEncoding = nil
          {$IFDEF STRING_IS_ANSI}; ASrcEncoding: IIdTextEncoding = nil{$ENDIF}
          ): string; overload;
        class procedure EncodeString(const AIn: string; ADestStrings: TStrings;
          AByteEncoding: IIdTextEncoding = nil
          {$IFDEF STRING_IS_ANSI}; ASrcEncoding: IIdTextEncoding = nil{$ENDIF}
          ); overload;
        class procedure EncodeString(const AIn: string; ADestStream: TStream;
          AByteEncoding: IIdTextEncoding = nil
          {$IFDEF STRING_IS_ANSI}; ASrcEncoding: IIdTextEncoding = nil{$ENDIF}
          ); overload;
    
        class function EncodeBytes(const ABytes: TIdBytes): string; overload;
        class procedure EncodeBytes(const ABytes: TIdBytes; ADestStrings: TStrings); overload;
        class procedure EncodeBytes(const ABytes: TIdBytes; ADestStream: TStream); overload;
    
        class function EncodeStream(ASrcStream: TStream; const ABytes: Integer = -1): string; overload;
        class procedure EncodeStream(ASrcStream: TStream; ADestStrings: TStrings; const ABytes: Integer = -1); overload;
        class procedure EncodeStream(ASrcStream: TStream; ADestStream: TStream; const ABytes: Integer = -1); overload;
      end;
    

     BASE64解码类:TIdDecoderMIME

    解码接口

      TIdDecoder = class(TIdBaseComponent)
      protected
        FStream: TStream;
      public
        procedure DecodeBegin(ADestStream: TStream); virtual;
        procedure DecodeEnd; virtual;
    
        procedure Decode(const AIn: string); overload;
        procedure Decode(ASrcStream: TStream; const ABytes: Integer = -1); overload; virtual; abstract;
    
        class function DecodeString(const AIn: string; AByteEncoding: IIdTextEncoding = nil
          {$IFDEF STRING_IS_ANSI}; ADestEncoding: IIdTextEncoding = nil{$ENDIF}
          ): string;
        class function DecodeBytes(const AIn: string): TIdBytes;
        class procedure DecodeStream(const AIn: string; ADestStream: TStream);
      end;
    

      

     

  • 相关阅读:
    学习web前端要去一线就业吗
    程序员什么时候该考虑跳槽
    前端工程师应该具备怎样的一种技术水平
    如何掌握学习移动端Web页面布局
    如何优化Web前端技术开发生态体系
    想进名企大厂?阿里程序员给你三点建议
    对即将入职前端工作的新人有哪些建议?
    Java基础学习之快速掌握Session和cookie
    Java入门学习之JDK介绍与初次编程实现
    Java编译的运行机制初步讲解
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/11904909.html
Copyright © 2020-2023  润新知