JAVA/CORBA CLASSES


Examples: getContents method
This agent writes to a stream using java.io.OutputStreamWriter.

import lotus.domino.*;
import java.io.*;

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();
     String outPath =
     "c:\\StreamFiles\\" + doc.getItemValueString("Subject") + ".txt";
     FileOutputStream fos = new FileOutputStream(outPath);
     OutputStreamWriter osw = new OutputStreamWriter(fos);
     Stream outStream = session.createStream();
     outStream.writeText(doc.getItemValueString("Body"));
     outStream.getContents(osw);
     osw.close();
     
   } catch(NotesException e) {
     e.printStackTrace();

   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also