Serialization byte array vs XML file

前端 未结 7 1859
礼貌的吻别
礼貌的吻别 2021-01-06 08:42

I am heavily using byte array to transfer objects, primitive data, over the network and back. I adapt java\'s approach, by having a type implement ISerializable, which cont

7条回答
  •  清酒与你
    2021-01-06 09:17

    XStream library provide an exceptionally good way of dealing with serialisation including support for XML, JSON and supporting custom converters. Specifically, the use of custom converters allowed us to reduce XML verbosity and to serialise strictly what is needed.

    XStream has no requirement to declare everything as Serializable, which is very important when one utilises a third-party lib and needs to serialise an instance of a class from that lib, which is not declared as Serializable.


    The answer is already accepted, but for the sake of completeness of this discussion here is a link to a good comparison between different serialisation approaches/libraries:

    http://code.google.com/p/thrift-protobuf-compare/wiki/Benchmarking

    The kryo library looks very compelling for Java serialisation. Similarly to XStream is supports custom converters.

提交回复
热议问题