问题描述
我有一个用gzip将数据发送WCF数据服务。我打算用读取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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!