简体   繁体   中英

How to store serialized java object (byte array) in couchbase?

I have byte[] array(serialized) and need to store it in couchbase. I need somethink like this?

 @Override
public void put(byte[] bytes) {
    Bucket bucket = getBucket();
    bucket.insert(bytes);
}

I have answered this question on https://ru.stackoverflow.com/q/786402/183406 already. But I can copy solution here:

@Override
public void put(String key, byte[] bytes) {
    Bucket bucket = getBucket();
    bucket.insert(ByteArrayDocument.create(key, bytes));
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM