CWMIMEUtility


MIME utility class.

Discussion

This class provides static methods to deal with the MIME standard. Normally, you should not invoke any of those methods directly.

Superclass

NSObject

Declared In

CWMIMEUtility.h



Methods

+compositeMessageContentFromRawSource:
+compositeMultipartContentFromRawSource:boundary:
+decodeHeader: charset:
+decodeHeader:charset:
+discreteContentFromRawSource: encoding: charset: part:
+discreteContentFromRawSource:encoding:
+encodeHeader: charset: encoding:
+encodeHeader:charset:encoding:
+encodeWordUsingBase64:prefixLength:
+encodeWordUsingQuotedPrintable:prefixLength:
+globallyUniqueBoundary
+globallyUniqueID
+plainTextContentFromPart:
+setContentFromRawSource: inPart:
+setContentFromRawSource:inPart:

compositeMessageContentFromRawSource:


+ (CWMessage *) compositeMessageContentFromRawSource: (NSData *) theData; 
Parameters
theData

The bytes to use.

Return Value

A Message instance, nil on error.

Discussion

This method is used to obtain a composite type (message) from theData.


compositeMultipartContentFromRawSource:boundary:


+ (CWMIMEMultipart *) compositeMultipartContentFromRawSource: (NSData *) theData 
        boundary: (NSData *) theBoundary; 
Parameters
theData

The bytes to use.

theBoundary

The boundary to use.

Return Value

A CWMIMEMultipart instance, nil on error.

Discussion

This method is used to obtain a composity type (multipart) from theData, using theBoundary.


decodeHeader: charset:


+ (NSString *) decodeHeader: (NSData *) theData charset: (NSString *) theCharset; 
Parameters
theData

The data to decode.

theCharset

The charset to force.

Return Value

The decoded header.

Discussion

This method is used to decode a header value encoded in base64 or quoted-printable. RFC 2047 describes how those headers should be encoded (in particular, "2. Syntax of encoded-words"). If theCharset is not nil, it is used to decode the header. Otherwise, the charset used in the header is used.

See Also

decodeHeader:charset:


decodeHeader:charset:


+ (NSString *) decodeHeader: (NSData *) theData charset: (NSString *) theCharset; 
Parameters
theData

The data to decode.

theCharset

The charset to force.

Discussion

This method is used to decode a header value encoded in base64 or quoted-printable. RFC 2047 describes how those headers should be encoded (in particular, "2. Syntax of encoded-words"). If theCharset is not nil, it is used to decode the header. Otherwise, the charset used in the header is used.

See Also

decodeHeader: charset:


discreteContentFromRawSource: encoding: charset: part:


+ (id) discreteContentFromRawSource: (NSData *) theData 
        encoding: (PantomimeEncoding) theEncoding; 
Parameters
theData

The bytes to use.

theEncoding

The encoding to use. Valid values are part of the PantomimeEncoding enum.

Return Value

A NSData instance.

Discussion

This method is used to obtain discrete types such as text/, application/, image/, etc. It might return a NSString or a NSData object (if the encoding is PantomimeEncodingBase64).

See Also

discreteContentFromRawSource:encoding:


discreteContentFromRawSource:encoding:


+ (id) discreteContentFromRawSource: (NSData *) theData 
        encoding: (PantomimeEncoding) theEncoding; 
Parameters
theData

The bytes to use.

theEncoding

The encoding to use. Valid values are part of the PantomimeEncoding enum.

Discussion

This method is used to obtain discrete types such as text/, application/, image/, etc. It might return a NSString or a NSData object (if the encoding is PantomimeEncodingBase64).

See Also

discreteContentFromRawSource: encoding: charset: part:


encodeHeader: charset: encoding:


+ (NSData *) encodeHeader: (NSString *) theText charset: (NSString *) theCharset 
        encoding: (PantomimeEncoding) theEncoding; 
Parameters
theText

The text to encode.

theCharset

The charset to use. For example, "iso-8859-1".

theEncoding

The encoding to use. Valid values are part of the PantomimeEncoding enum.

Return Value

The encoded data.

Discussion

This method is used to encode a header value in the format specified by RFC 2047 (in particular, "2. Syntax of encoded-words").

See Also

encodeHeader:charset:encoding:


encodeHeader:charset:encoding:


+ (NSData *) encodeHeader: (NSString *) theText charset: (NSString *) theCharset 
        encoding: (PantomimeEncoding) theEncoding; 
Parameters
theText

The text to encode.

theCharset

The charset to use. For example, "iso-8859-1".

theEncoding

The encoding to use. Valid values are part of the PantomimeEncoding enum.

Discussion

This method is used to encode a header value in the format specified by RFC 2047 (in particular, "2. Syntax of encoded-words").

See Also

encodeHeader: charset: encoding:


encodeWordUsingBase64:prefixLength:


+ (NSData *) encodeWordUsingBase64: (NSString *) theWord 
        prefixLength: (int) thePrefixLength; 

encodeWordUsingQuotedPrintable:prefixLength:


+ (NSData *) encodeWordUsingQuotedPrintable: (NSString *) theWord 
        prefixLength: (unsigned int) thePrefixLength; 

globallyUniqueBoundary


+ (NSData *) globallyUniqueBoundary; 
Return Value

The boundary, as a NSData instance.

Discussion

This method is used to generate a unique MIME boundary (or any kind of boundary).


globallyUniqueID


+ (NSData *) globallyUniqueID; 
Return Value

The unique ID, as a NSData instance.

Discussion

This method is used to generate a unique ID that CWMessage (or CWPart) instances use as their unique ID. (Message-ID, Content-ID, etc.)


plainTextContentFromPart:


+ (NSData *) plainTextContentFromPart: (CWPart *) thePart; 
Parameters
thePart

The Part instance from which to obtain the text.

Return Value

The pure "text".

Discussion

This method is used to obtain a pure "text" part. For example, it can be used to strip any HTML content from a part in order to get only the text.


setContentFromRawSource: inPart:


+ (void) setContentFromRawSource: (NSData *) theData inPart: (CWPart *) thePart; 
Parameters
theData

The bytes to use.

thePart

The part to use, which can be a Part or a Message instance.

Discussion

This method is used to initialize a message, or a part of the message using theData. The CWPart's Content-Type MUST be defined BEFORE calling this function otherwise the content will be considered as a pure string.

See Also

setContentFromRawSource:inPart:


setContentFromRawSource:inPart:


+ (void) setContentFromRawSource: (NSData *) theData inPart: (CWPart *) thePart; 
Parameters
theData

The bytes to use.

thePart

The part to use, which can be a Part or a Message instance.

Discussion

This method is used to initialize a message, or a part of the message using theData. The CWPart's Content-Type MUST be defined BEFORE calling this function otherwise the content will be considered as a pure string.

See Also

setContentFromRawSource: inPart: