How to transfer objects over network using java

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

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

4条回答
  •  遥遥无期
    2021-01-14 14:34

    The easiest way is probably using serialization. Therefore, your object classes must implement serializable, so do have all of the members (primitves and most of the standard java classes already do this). This allows the mapping between object instances and byte streams at runtime.

    You also need a protocol for transer. You can have a look at RMI, if you don't want to deal with streaming you byte streams over the wire, though this is not that difficult. Using RMI however allows you build more powerful distributed java applications later.

提交回复
热议问题