> On Apr 11, 2015, at 6:30 AM, Jared McFarland <[email protected]> wrote: > > However, the whole point of LDSON is that you don't have to wait for the > entire response, so I'm trying to figure out the best way to go about parsing > the data as it streams in
Just accumulate the incoming data into an NSMutableData object. After you append new bytes, look for a newline in the data (probably using memchr or something like that). If you find one, copy the bytes from the start to just before the newline into a new NSData, then use NSJSONSerialization to parse it. Then delete the consumed bytes (including the newline) from the mutable data buffer. —Jens -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/BDBC46C8-B3F8-46D4-A430-B654A4630142%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
