如何使用java在网络上传输对象 [英] How to transfer objects over network using java

查看:85
本文介绍了如何使用java在网络上传输对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该使用什么库?
有哪些功能可以帮助我?

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

推荐答案

最简单的方法可能是使用序列化。因此,您的对象类必须实现可序列化,因此请确保所有成员(原始和大多数标准java类已经执行此操作)。这允许在运行时在对象实例和字节流之间进行映射。

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.

您还需要一个转换协议。您可以查看 RMI ,如果您不知道我不想通过线路处理流式传输字节流,尽管这并不困难。
但是,使用RMI可以在以后构建更强大的分布式Java应用程序。

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.

这篇关于如何使用java在网络上传输对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆