通过Web服务压缩对象/字符串并在.net紧凑框架中使用
我们需要使用 Web 服务压缩(或者更确切地说解压缩)发送到 PDA 客户端的一些数据。
下面我有一个简单的概念,如果被常规 .net 应用程序使用,它将起作用。
不幸的是,由于紧凑框架没有 IO.Compression 类,如果不编写我们自己的压缩算法,我们就无法看到这是如何实现的(因为您无法在 pda 客户端解压缩)。
我们只能使用.net 2。
Dim c As New TestClass
c.Prop1 = "Test"
c.Prop2 = 1234
Dim XmlMemStream As New IO.MemoryStream
Dim mySerilizedObj As Xml.Serialization.XmlSerializer = New Xml.Serialization.XmlSerializer(GetType(TestClass))
mySerilizedObj.Serialize(XmlMemStream, c)
Dim gz As New IO.Compression.GZipStream(XmlMemStream, IO.Compression.CompressionMode.Compress, False)
这需要在应用程序级别而不是服务器级别(HTTP 压缩)完成。
谢谢
We need to compress (or rather uncompress) some data we send to a pda client using a webservice.
Below I have a simple concept that will work if consumed by a regular .net app.
Unfortuantly, as the compact framework doesn't have the IO.Compression classes we can't see how this is possible without writing our own compression algorithms (as you'd don't have the ability to uncompress at the pda client end).
We have to use .net 2 only.
Dim c As New TestClass
c.Prop1 = "Test"
c.Prop2 = 1234
Dim XmlMemStream As New IO.MemoryStream
Dim mySerilizedObj As Xml.Serialization.XmlSerializer = New Xml.Serialization.XmlSerializer(GetType(TestClass))
mySerilizedObj.Serialize(XmlMemStream, c)
Dim gz As New IO.Compression.GZipStream(XmlMemStream, IO.Compression.CompressionMode.Compress, False)
This needs to be done at application level and not Server Level (HTTP compression).
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试在客户端上使用 SharpZipLib ,我已经在 Compact Framework 上成功使用了它。
You could try using SharpZipLib on the client, I have used it successfully on Compact Framework.