indy html 编码,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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值