问题
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