/** * 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(); } }
@Kroll.method public void setAttachment(String name, String contentType, TiBlob content) { ((UnsavedRevision) revision).setAttachment(name, contentType, content.getInputStream()); }