Examples: Position property (Stream - Java™)
This agent writes the content of the Body item of the selected document to a stream, then positions the stream to the beginning (0) before reading from it.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
DocumentCollection dc = agentContext.getUnprocessedDocuments();
Document doc = dc.getFirstDocument();
// Create stream and write text of Body item to it
Stream stream = session.createStream();
stream.writeText(doc.getItemValueString("Body"));
// Reset position to beginning and read text
stream.setPosition(0);
System.out.println(stream.readText());
} catch(NotesException e) {
e.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}
}
}