Topic Path: Symbol Reference > Classes > TIdAttachmentMemory Class > TIdAttachmentMemory Methods > PrepareTempStream Method
ContentsIndexHome
PreviousUpNext
TIdAttachmentMemory.PrepareTempStream Method

Provides a stream for accessing the contents of the message part.

function PrepareTempStream: TIdStream; override;

TStream - Stream containing the contents for the message part.

PrepareTempStream is an overridden TIdStream function that implements the method used to obtain a stream containing data for the message part. 

The return value for the method is the TIdStream instance in the DataStream property. 

PrepareTempStream is called when loading or receiving a message with in-memory attachments. When a TIdMessage instance is received and processed using TIdMessageClient, or a descendant class, the overridden PrepareTempStream and FinishTempStream methods for the attachment are called. These methods apply to both receiving a message from a remote mail server or accessing a message from a local mail store. Essentially, loading a message and receiving a message are the same - differing only in the type of stream used to read the message contents. 

PrepareTempStream ensures that the temporary stream used for processing the contents of the message part is set to its origin prior to reading values to be stored in a TIdMessage instance. 

FinishTempStream is used to ensure that the temporary stream used for processing the contents of the message part is reset after reading values stored in the message part. 

The ProcessMessage, ReceiveHeader, and ReceiveBody methods in TIdMessageClient rely on the overridden methods. 

Make sure all content in the message or message part has been saved using SaveToFile prior to calling Destroy for the TIdMessage or the TIdAttachmentMemory message part.

TIdAttachmentMemory.PrepareTempStream 

TIdAttachmentMemory.FinishTempStream 

TIdAttachment.FinishTempStream 

TIdMessage.LoadFromFile 

TIdMessage.LoadFromStream 

TIdMessage.ProcessMessage 

TIdMessage.ReceiveHeader 

TIdMessage.ReceiveBody

Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.