getInputStream() and performance

EmbeddedObject.getInputStream() method which is used to create an InputStream for fetching contents of the file attachment takes a lot of time because Domino needs to detach the attachment to a temporary file before it can return an InputStream. I have used recycle() method to delete the file and have explicitly closed the InputStream before recycling the EmbeddedObject.

Still the time consumed in fetching the InputStream takes a lot of time while working with huge databases. Is there any alternate way for fething the inputStream which is more efficient.

following is the code that i’ve used:

import lotus.domino.*;

import java.util.*;

import java.io.*;

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {

  Session session = getSession();

  AgentContext agentContext = session.getAgentContext();

  DocumentCollection dc = agentContext.getUnprocessedDocuments();

  Document doc = dc.getFirstDocument();



  RichTextItem body = (RichTextItem)doc.getFirstItem("Body");

  Vector v = body.getEmbeddedObjects();

  Enumeration e = v.elements();

  while (e.hasMoreElements()) {

    EmbeddedObject eo = (EmbeddedObject)e.nextElement();

    if (eo.getType() == EmbeddedObject.EMBED_ATTACHMENT) {

      InputStream is = eo.getInputStream();

      System.out.println(eo.getName());

      is.close();

      eo.recycle();

    }

  }



  body.recycle();

  doc.recycle();



} catch(Exception e) {

    e.printStackTrace();

}

}

}

we need to resolve this problem really quick, so an urgent help would be great…thanks!

Ajit

Subject: getInputStream() and performance

Hi,

We are facing similar issue at our end and we need to resolve this asap. Can you please guide us? Kindly let us know how you solved this problem.

Thanks,

Priya