getContentAsText (NotesMIMEEntity - JavaScript)

Gets the content of the current MIME entity as text.

Defined in

NotesMIMEEntity

Syntax

getContentAsText(stream:NotesStream) : void

getContentAsText(stream:NotesStream, decoded:boolean) : void

Parameter Description
stream Output medium for the text.
decoded Specify true (default) to decode the content, false to leave any encoding in place.

Usage

This method sets the stream Position at end of stream.

To get the MIME content as a string object, see the ContentAsText property.

The signatures for this method have the same name as the signature for the ContentAsText property.

Examples

This button displays the content of the current document if it is in text/plain MIME format.
// Do not automatically convert MIME to rich text
session.setConvertMIME(false);
var mime:NotesMIMEEntity = currentDocument.getDocument().getMIMEEntity();
if (mime != null) {
	if (mime.getContentType().equals("text") &&
	mime.getContentSubType().equals("plain")) {
		var stream:NotesStream = session.createStream();
		mime.getContentAsText(stream);
		stream.setPosition(0); // must reset the stream position
		requestScope.status = stream.readText();
	}
} else {
	requestScope.status = "Not MIME";
}
// Restore conversion
session.setConvertMIME(true);