Click or drag to resize
MimeKit

ImapFolderCreateStream Method

Create a backing stream for use with the GetMessage, GetBodyPart, and GetStream methods.

Namespace: MailKit.Net.Imap
Assembly: MailKit (in MailKit.dll) Version: 4.3.0
Syntax
C#
protected virtual Stream CreateStream(
	UniqueId? uid,
	string section,
	int offset,
	int length
)

Parameters

uid  NullableUniqueId
The unique identifier of the message, if available.
section  String
The section of the message that is being fetched.
offset  Int32
The starting offset of the message section being fetched.
length  Int32
The length of the stream being fetched, measured in bytes.

Return Value

Stream
The stream.
Remarks

Allows subclass implementations to override the type of stream created for use with the GetMessage, GetBodyPart and GetStream methods.

This could be useful for subclass implementations that intend to implement support for caching and/or for subclass implementations that want to use temporary file streams instead of memory-based streams for larger amounts of message data.

Subclasses that implement caching using this API should wait for CommitStream(Stream, UniqueId, String, Int32, Int32) before adding the stream to their cache.

Streams returned by this method SHOULD clean up any allocated resources such as deleting temporary files from the file system.

Note  Note
The uid will not be available for the various GetMessage(), GetBodyPart() and GetStream() methods that take a message index rather than a UniqueId. It may also not be available if the IMAP server response does not specify the UID value prior to sending the literal-string token containing the message stream.
See Also