开发者

Java: Serialization/ Deserialization to/from XML instead of binary

开发者 https://www.devze.com 2022-12-19 05:54 出处:网络
I have a complex set of data models that currently implement java.io.Serializable, and I have successfully serialized and deserialized them with ObjectOutputStream and ObjectInputStream.

I have a complex set of data models that currently implement java.io.Serializable, and I have successfully serialized and deserialized them with ObjectOutputStream and ObjectInputStream.

However, the result are binary files (as expected), and I was wondering if Java supports serialization and deserialization in the same manner to a non-binary format, such as XML.


I see that C# has this feature: XML vs Binary performance for Serialization/Deserialization.

Performance speed/ efficiency is not a considerati开发者_StackOverflowon in this case.


Further, I would suggest you to look at Simple and XStream frameworks. I found both good. You can choose to go with either one, or may be XmlEncoder as suggested by Jack.


Yes, Java has it and it's called XML Encoding. Check it out here!

The approach is quite similar to the normal serialization..

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号