如何去code的GZip流与Android的odata4j [英] How to decode GZip stream with odata4j in Android

查看:165
本文介绍了如何去code的GZip流与Android的odata4j的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用gzip将数据发送WCF数据服务。我打算用 odata4j 读取COM pressed流。如果不是COM pressed,它工作正常。
我应该怎么修改,以便能够通过odata4j读取COM pressed流?

下面是C#code的COM presses流:

 的HttpContext的HttpContext = HttpContext.Current;
      如果(HttpContext的!= NULL)
        httpContext.Response.Filter =新GZipStream(httpContext.Response.Filter,COM pressionMode.Com preSS);

这里是Odata4j一部分读取数据:

  ODataConsumer消费= ODataJerseyConsumer.create(URL);
 清单< OEntity> listEntities = consumer.getEntities(数据)
          .execute()了ToList()。


解决方案

Odata4j支持COM pressed内容下载,无需额外配置。但是, uncom pression任务占用如此多的CPU时间的,由较小的数据传输所获得的时间几乎完全被浪费掉了。

I have a WCF Data Service that sends data with GZip. I intend to use odata4j to read that compressed stream. If it is not compressed, it works fine. What should I modify to be able to read the compressed stream via odata4j?

Here is the C# code that compresses the stream:

 HttpContext httpContext = HttpContext.Current;
      if (httpContext != null)
        httpContext.Response.Filter = new GZipStream(httpContext.Response.Filter, CompressionMode.Compress);

And here is the Odata4j part that reads the data:

 ODataConsumer consumer = ODataJerseyConsumer.create(url);
 List<OEntity> listEntities=consumer.getEntities("Data")
          .execute().toList();

解决方案

Odata4j supports compressed content download, no additional configuration is required. However, the uncompression task consumes so much CPU time, that the time gained by the lesser data transfer is almost completely wasted.

这篇关于如何去code的GZip流与Android的odata4j的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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