예제 #1
0
  /**
   * Write an Attachment for a given Document
   *
   * @param docId
   * @param attachName
   * @param mimeType e.g. "image/jpeg"
   * @param in
   */
  public void writeAttachment(String docId, String attachName, String mimeType, InputStream in) {

    try {
      Document doc = database.getDocument(docId);
      UnsavedRevision newRev = doc.getCurrentRevision().createRevision();
      newRev.setAttachment(attachName, mimeType, in);
      newRev.save();
    } catch (CouchbaseLiteException e) {
      e.printStackTrace();
    }
  }
예제 #2
0
 @Kroll.method
 public void setAttachment(String name, String contentType, TiBlob content) {
   ((UnsavedRevision) revision).setAttachment(name, contentType, content.getInputStream());
 }