Indy 9
TIdMessageDecoder
Hierarchy, Properties, Methods, Events, See Also, Unit: IdMessageCoder
Implements a decoder for RFC-822 compliant message parts.
TIdMessageDecoder = class(TIdComponent)
Unit
IdMessageCoder
Description
TIdMessageDecoder is a TIdComponent descendant that implements a decoder for RFC-822 compliant message parts. TIdMessageDecoder provides properties and methods used to process RFC message header and body lines using a TStream descendant. TIdMessageDecoder is a base class that establishes the framework for Indy message decoders.

TIdMessageDecoder descendants, like TIdMessageDecoderMIME and TIdMessageDecoderUUE, further refine the message decoder framework by implementing support for encoding schemes.


TIdMessageDecoder.Filename
TIdMessageDecoder, See Also
Represents the file name for RFC-822 message attachments.
property Filename: string;
Description
Filename is a read-only String property that represents the file name for an attachment in a RFC-822 compliant message part. Filename is used by TIdMessageDecoder descendants, like TIdMessageDecoderMIME, TIdMessageDecoderUUE, and TIdMessageDecoderUUE.

TIdMessageDecoder.Headers
TIdMessageDecoder, See Also, Example
Represents the RFC message headers in an RFC-822 compliant message part .
property Headers: TStrings;
Description
Headers is a read-only TStrings property that represents the RFC message headers in an RFC-822 compliant message part. Headers is used by TIdMessageDecoder descendants to store the header values parsed from the RFC message part.

Headers will contain a TStrings representation of header names and values that orignate in RFC-822 form. For example, the following RFC-822 message header is stored in a Headers in the following form:

    RFC-822 Message Header   Content-Transfer-Encoding: base64
    Header representation    Content-Transfer-Encoding=base64

Use TStrings methods and properties to access Header values in TIdMessageDecoder.


TIdMessageDecoder.PartType
TIdMessageDecoder, See Also
Represents the type for an RFC message part.
property PartType: TIdMessageCoderPartType;
Description
PartType is a read-only TIdMessageCoderPartType property that represents the type detected for an RFC-822 compliant message part. PartType is used in TIdMessageDecoder descendants, like TIdMessageDecoderMIME, TIdMessageDecoderUUE, and TIdMessageDecoderUUE. PartType is updated when ReadHeader is called to extract the RFC messaage headers in a message part. PartType is used in ReadBody to determine the TIdDecoder descendant that will be needed to process thte message part.

TIdMessageDecoder.SourceStream
TIdMessageDecoder, See Also
Providess access to a RFC-822 message as a stream construct.
property SourceStream: TStream;
Description
SourceStream is a TStream property in TIdMessageDecoder that provide access to the contents of a RFC-822 message part. SourceStream is used by the ReadLn method to retrieve a single line in the RFC-822 message.

TIdMessageDecoder.Create
TIdMessageDecoder, See Also
Constructor for the object instance.
constructor Create(AOwner: TComponent); override;
Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance, and relies on the inherited Create method initialize properties to their default values. Create also instantiates a TStringList instance that represents the Headers property.

TIdMessageDecoder.Destroy
TIdMessageDecoder, See Also
Destructor for the object instance.
destructor Destroy; override;
Description
Destroy is the Destructor for the object instance. Destroy frees and releases resources allocated to the Headers and SourceStream properties prior to calling the inherited Destroy method.

TIdMessageDecoder.ReadBody
TIdMessageDecoder, See Also
Specifies the message decoder method used to extract an RFC-822 message body.
function ReadBody(ADestStream: TStream; var AMsgEnd: Boolean): TIdMessageDecoder; virtual; abstract;
Parameters
ADestStream: TStream
Stream where message body content will be stored.
Return Value
TIdMessageDecoder - Message decoder used to process the message part.
Description
ReadBody is an abstract virtual function in TIdMessageDecoder that Specifies the method used to extract an RFC-822 message body in TIdMessageDecoder descendants to the ADest stream.

TIdMessageDecoder descendants must re-implement the ReadBody method to provide support for the appropriate encoding algorithm and/or processing based on specific RFC message header values.


TIdMessageDecoder.ReadHeader
TIdMessageDecoder, See Also
Specifies the method used to read an RFC message body.
procedure ReadHeader; virtual;
Description
ReadHeader is a virtual procedure in TIdMessageDecoder that specifies the method used to read an RFC-822 compliant message body. TIdMessageDecoder descendants, like TIdMessageDecoderMIME and TIdMessageDecoderUUE, must override ReadHeader to implement storage of parsed header names and values in message Headers. ReadHeader must also update PartType based on header values specific to the message decoder class. Additional properties in a descendant class may also require updates based on values detected in Header.

TIdMessageDecoder.ReadLn
TIdMessageDecoder, See Also
Reads a line from an RFC message part.
function ReadLn: string;
Return Value
String - Line read from the message part.
Description
ReadLn is a String function in TIdMessageDecoder that a single line from an RFC-822 compliant message part. ReadLn uses SourceStream, cast to a TIdStream instance, as the origin of data for the TIdStream.ReadLn method.

The return value for ReadLn can be an empty string ("") when the line from SourceStream consists of only a line termintaion character sequence, or the end of SourceStream has been reached.


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.