How to decode GZip stream with odata4j in Android

烈酒焚心 提交于 2019-12-11 15:59:11

问题


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();

回答1:


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.



来源:https://stackoverflow.com/questions/19786245/how-to-decode-gzip-stream-with-odata4j-in-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!