序列化是唯一可用于发送数据的选项吗? [英] Is serialization the only option available for sending data?

查看:62
本文介绍了序列化是唯一可用于发送数据的选项吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将引用类型对象发送到不同的目标/应用程序。在发送对象之前是否需要序列化对象?在这种情况下,我们是否还有其他可用于序列化过程的替代方案?



我尝试过:



我需要将引用类型对象发送到不同的目标/应用程序。在发送对象之前是否需要序列化对象?在这种情况下,我们是否有其他可用于序列化过程的替代方法?

I need to send a reference type object to a different destination/application. Do I need to serialize the object before sending it?; Do we have other alternative available to serialization process in such case?

What I have tried:

I need to send a reference type object to a different destination/application. Do I need to serialize the object before sending it?; Do we have other alternative available to serialization process in such case?

推荐答案

您必须以预期的形式将数据发送到目的地。



如果你正在编写这两个应用程序,你可以随意做,但是使用JSON之类的东西可以更容易实现和维护。
You have to send the data to the destination in the form it is expecting.

If you are writing both applications you can do as you please, however using the likes of JSON makes it easier to implement and maintain.


Quote:

我需要将引用类型对象发送到不同的目标/应用程序。在发送对象之前是否需要序列化对象?在这种情况下,我们是否有其他可用于序列化过程的替代方法?

I need to send a reference type object to a different destination/application. Do I need to serialize the object before sending it?; Do we have other alternative available to serialization process in such case?

替代方法是滚动您自己的序列化机制,即

  • 检索对象的所有状态信息。
  • 使用两个应用程序共有的协议编写此类信息(并将其发送到其他应用程序)
  • 在目标应用程序端,使用检索到的信息,构建一个新对象。
  • The alternative is rolling your own serializzation mechanism, that is

    • Retrieve all state information of the object.
    • Write such information using a protocol common to both the applications (and send it to the other application)
    • On the target application side, using the information retrieved, build up a fresh object.

    • 这篇关于序列化是唯一可用于发送数据的选项吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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