问题描述
我有一个用Java编写的服务器用C#编写的客户端。他们通过XMPP进行交互和发送信息到另一个。的消息是XML,其中一些可能是非常大的。我正想着COM pressing的数据,但我不知道什么是技术上做到这一点的最好办法,因为我是COM pressing Java和DECOM pressing在C#。
I have a server written in Java and a client written in C#. They interact via XMPP and send messages to one another. The messages are XML, and some of them can be very large. I'm thinking about compressing the data, but I wonder what would be the best way to do this technically, since I'm compressing in Java and decompressing in C#.
很显然,我需要的COM pressed缓冲区转化为Base64,传播它,去$ C C的BASE64然后DECOM preSS是$。我应该使用什么设备在JDK和.NET到COM preSS / DECOM preSS的数据?
Obviously I need to translate the compressed buffer to BASE64, transmit it, decode the BASE64 and then decompress it. What facilities in JDK and .NET should I use to compress/decompress the data?
推荐答案
在.NET中可以使用的。
In .NET you can use System.IO.Compression.GZipStream
.
在Java的 java.util中。 zip.GZIPOutPutStream 似乎适用于COM pression任务。
In Java java.util.zip.GZIPOutPutStream seem suitable for the compression task.
编辑:
另一种方法是7-ZIP。有一个人员为C#和Java。
Another alternative might be 7-zip. There is an SDK for both c# and Java.
编辑2:
快速谷歌的XMPP COM pression显示,XMPP本身支持流融为一体pression 。这将COM preSS你的整个沟通,不会要求你为Base64 EN code你的COM pressed数据。这听起来更像是一个更高效,更兼容的方式对COM preSS数据不仅仅是COM pressing您的有效载荷。
Edit 2:
A quick Google on "XMPP compression" reveals that XMPP itself support stream compression. This will compress your whole communication and will not require you to BASE64 encode your compressed data. This sounds more like a more efficient and more compatible way to compress your data than just compressing your payload.
这篇关于如何从Java传递COM pressed字符串到C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!