setContents (NotesStream - JavaScript)

Copies java.io.InputStream or java.io.Reader contents to a stream.

Defined in

NotesStream

Syntax

setContents(stream:java.io.InputStream) : void

setContents(stream:java.io.Reader) : void

Usage

If the stream has content, the new content is appended.

When a stream is copied, property values are:

Examples

This button creates a document from the name and content of a file.
var inPath:string = requestScope.filename;
var fis = new java.io.FileInputStream(inPath);
var isr = new java.io.InputStreamReader(fis, "ASCII");
var inStream:NotesStream = session.createStream();
inStream.setContents(isr);
var doc:NotesDocument = database.createDocument();
doc.replaceItemValue("Form", "main");
doc.replaceItemValue("subject", inPath);
doc.replaceItemValue("body", inStream.readText());
inStream.close();
doc.save(true, true);