.NET 到 Java 序列化/反序列化的兼容性 [英] .NET to Java serialization/deserialization compatibility

查看:96
本文介绍了.NET 到 Java 序列化/反序列化的兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 .NET 中序列化对象然后在 Java 中反序列化时,是否有任何兼容性问题需要处理?

Are there any compatibility issues to take care of when serailizing an object in .NET and then deserializing in Java?

我在反序列化 Java 中已在 .NET 中序列化的对象时遇到问题

I am facing problems in de-serializing an object in java which has been serialized in .NET

这里是详细的问题陈述:

Here is the detailed problem statement:

在 .NET 平台中,我有一个 cookie.1.cookie被序列化2.然后使用Triple DES算法对其进行加密.3. 将其发送到 Java 应用程序

In .NET platform i have a cookie. 1. Cookie is serialized 2. then it is encrypted using Triple DES algo. 3. Send it across to Java application

在Java平台1. 使用 Triple DES 解密 cookie,给出一些字节2. 使用类似

In Java platform 1. Decrypt the cookie using Triple DES which gives some bytes 2. Deserialize the bytes using something like

new ObjectInputStream(new ByteArrayInputStream(byte[]decryptedCookie)).readObject();

new ObjectInputStream( new ByteArrayInputStream(byte[] decryptedCookie)).readObject();

我得到的异常堆栈跟踪是:java.io.StreamCorruptedException:无效的流标头:2F774555在 java.io.ObjectInputStream.readStreamHeader(Unknown Source)在 java.io.ObjectInputStream.(Unknown Source)

The exception stack trace I get is: java.io.StreamCorruptedException: invalid stream header: 2F774555 at java.io.ObjectInputStream.readStreamHeader(Unknown Source) at java.io.ObjectInputStream.(Unknown Source)

推荐答案

WOX 序列化程序为.Net 和 Java.

The WOX serializer provides interoperable serialization for .Net and Java.

这篇关于.NET 到 Java 序列化/反序列化的兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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