开发者

YAJL-ObjC + Streaming Parser + gzip

开发者 https://www.devze.com 2023-01-03 20:19 出处:网络
I\'m successfully using yajl-objc along with ASIHTTPRequest in an iPhone project that does network access and pulls down and parses JSON data. ASIHTTPRequest allows gzipped HTTP responses by default,

I'm successfully using yajl-objc along with ASIHTTPRequest in an iPhone project that does network access and pulls down and parses JSON data. ASIHTTPRequest allows gzipped HTTP responses by default, which is great, but I'm using the streaming parser ability of YAJL and it rightfully chokes on gzipped data. I can wait until the HTTP request has finished then un-g开发者_如何学编程zip and parse the response, but I'm going for speed here and would like to parse the gzipped data as it downloads.

Is it possible to un-gzip data on the fly, parse the JSON within, then forget about that chunk of gzipped data?

If this last part could be solved, this setup seems like it would make for a great system:

  • YAJL is one of the fastest JSON parsers around
  • ASIHTTPRequest is easy and asynchronous
  • Response bodies could be gzipped, saving on-the-wire traffic
  • JSON could be parsed without loading the whole tree into constrained device memory

Any guidance would be greatly appreciated!


YES: http://groups.google.com/group/asihttprequest/browse_thread/thread/ee2e44379b181439/7699dd200780cd32#7699dd200780cd32

0

精彩评论

暂无评论...
验证码 换一张
取 消