序列化在android系统? [英] Serialization in android?

查看:121
本文介绍了序列化在android系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我使用不同的虚拟机(甲骨文热点,JSE)序列化对象,并使用Android的虚拟机(Dalvik的)反序列化它。会不会有什么问题?

Hi I am serializing an object using different VM (Oracle hotspot,jse) and deserializing it with android VM(dalvik). will there be any problem?

推荐答案

假设由系列化你的意思是序列化,然后是。序列化不保证在不同的虚拟机是相同的。请使用别的东西(例如,XML,JSON)。

Assuming that by "serialization" you mean Serializable, then yes. Serialization is not guaranteed to be the same across distinct VMs. Please use something else (e.g., XML, JSON).

更新

您的第一个评论是这样的缺陷,我不适合我的500个字符的响应。

Your first comment is so flawed that I cannot fit my response in 500 characters.

ofcourse是的。没有实现Serializable我们不能序列

ofcourse yes. without implementing Serializable we cannot serialize

天才程序员可以。有才华的程序员可以串行化数据为XML,JSON,协议缓冲区,节俭,ASN.l,YAML,和任何数量的其它格式。

Talented programmers can. Talented programmers can serialize data to XML, JSON, Protocol Buffers, Thrift, ASN.l, YAML, and any number of other formats.

究竟是什么我做的是我在使用的ObjectOutputStream(甲骨文热点)网络写作的对象,并使用ObjectInputStream的阅读对Android的对象

what actually i am doing is i am writing an object on to the network using ObjectOutputStream(oracle hotspot) and reading that object on the android using ObjectInputStream

天才程序员使用独立于平台的序列化方式,如任我上面列出的那些的。这是因为天才程序员意识到,在将来,可以需要有不基于在Java客户端或服务器。

Talented programmers use platform-independent serialization approaches, such as any of the ones I listed above. That is because talented programmers realize that, in the future, there may be need to have clients or servers that are not based in Java.

所以你的意思是说,截至目前,这是好的,但在未来,不能保证。

So you mean to say as of now this is fine but in the future it is not guaranteed.

没有。我写道:

序列不保证在不同的虚拟机相同。

Serialization is not guaranteed to be the same across distinct VMs.

使用一个虚拟机(例如,甲骨文)应该能够序列化的对象进行反序列化的使用VM 。谁也不能保证,与一个VM序列化的对象可以使用另一个VM反序列化。事实上,开发商已在努力做precisely你正在尝试做的麻烦得到。这就是为什么有才华的程序员使用独立于平台的系列化结构的另一个例子。

An object serialized using one VM (e.g., Oracle) should be able to be de-serialized using that VM. There is no guarantee that an object serialized with one VM can be de-serialized using another VM. In fact, developers have gotten in trouble trying to do precisely what you are trying to do. This is another example of why talented programmers use platform-independent serialization structures.

这篇关于序列化在android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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