How to transfer objects over network using java

前端 未结 4 541
执笔经年
执笔经年 2021-01-14 14:06

what is the library should I use ? what are the functions that help me?

4条回答
  •  没有蜡笔的小新
    2021-01-14 14:26

    It Depends:

    If the other endpoint is in Java then Java serialization might be the fastest way to implement. But note supporting Java Serialization is not a trivial task and can be a chore to maintain over time. Just google "Java serialization gotchas" for some examples.

    If the other endpoint is not in Java or future maintainability and compatibility is a goal, then I would recommend a more general reusable encoding. For this I would look into Google Protocol Buffers or Apache Thrift (I can post only 1 hyperlink).

    Of course, there is always the option of using XML to encode your objects. :)

    Personally, in our projects we have been using Google Protocol Buffers and in my opinion can't be beat for ease of use, maintainability, and most important in our case, compatibility between Protocol Buffer versions.

提交回复
热议问题