title: Write contents of InputStream to a RichTextItem and attach to a Notes document in Java
body: <p>I am able to attach a file to <code>RichTextItem</code> of a domino document that I receive as an <code>InputStream</code>. Below is the code snippet:</p>
  
  <pre><code>attachDocument(InputStream is){
      .....
      File attFile = saveInputStr(is);
      Document attdoc = testdb.createDocument();
      attDoc.replaceItemValue("Form", "formAttachment");
      RichTextItem rti = (RichTextItem) attDoc.getFirstItem("attachment");
      rti.embedObject(EmbeddedObject.EMBED_ATTACHMENT, "", attFile .getPath(), attFile .getName());
      .....
  }
  </code></pre>
  
  <p>This works fine. But what if I don't want to write the file to disk, like I save it to a <code>File</code> i.e. <code>attFile</code> in the above snippet. Is there a way that to write the contents of <code>InputStream</code> to a file (may be using some notes document) and attach it with out saving to disk.</p>