0
如何将图像保存在核心java中的couchbase lite中? 当我们将图像保存在couchase服务器中时,我们将图像转换为字节并保存字节。 但它在couchbase lite中没有那样的。 请帮助我。将图像保存在couchbase lite中java
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);
我将图像转换为字节数组并将其保存到couchbase lite文件 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 img_properties = new HashMap (); img_properties.put(“image”,bytes); img_doc.putProperties(img_properties); –