Save image in couchbase lite java -


how save image in couchbase lite in core java? save image in couchase server, convert image bytes , save bytes. not having in couchbase lite. kindly me.

final bufferedimage image = imageio.read(new file(file.getpath())); bytearrayoutputstream baos = new bytearrayoutputstream(); imageio.write(image, "png", baos);  document img_doc = db.getdocument("image");  map<string, object> img_properties = new hashmap<string, object>();  img_properties.put("image", bytes);  img_doc.putproperties(img_properties); 

any non-valid json type (like image example) can stored in couchbase lite binary attachment. attachment created using setattachment on revision object. content of attachment stored in filesystem , revision keeps reference it. way, can attachment through document or revision object. see code example here.


Comments

Popular posts from this blog

html - height not adding height to a empty div -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

python - Robot Framework location and name of keyword -