Implementing in-memory compression for objects in Java

后端 未结 8 1943
忘了有多久
忘了有多久 2020-12-13 02:29

We have this use case where we would like to compress and store objects (in-memory) and decompress them as and when required.

The data we want to compress is quite

8条回答
  •  粉色の甜心
    2020-12-13 02:43

    If you need to compress arbitrary objects, a possible approach is to serialize the object into a byte array, and then use e.g. the DEFLATE algorithm (the one used by GZIP) to compress it. When you need the object, you can decompress and deserialize it. Not sure about how efficient this would be, but it will be completely general.

提交回复
热议问题