You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a huge file on the web that I need to parse, and would really rather do it by parsing it as its read, rather than downloading it. I looked at your NSInputStream, but you don't use the delegate, and its unclear how NSInputStream would operate if given a direct URL - since it manages a runloop I guess it just blocks CHCSVParser when it asks for data and there is none.
So I looked at your code and wondered about trying to wire in a NSInputStream delegate - I guess anything is possible - but that means I have to create a background thread, add a runloop, and do all this myself (Jens A has a nice thread that Quinn responded to on the networking listserv a few years ago).
Another idea came to mind, one that would allow the use of GCD directly. Instead of using a NSInputStream, you'd use a NSObject that conforms to a protocol comprised of your current use of NSInputStream. Then, I'd create another object that meets that protocol too - but uses GCD to essentially block when 'hasData...' or 'read...' is called. This would be really simple and clean, no NSThread or runloop.
My reason for asking here is that if you would consider accepting a pull request, I'll do all the work and when its working well in my production environment, I'll issue a pull request. However, if you have no interest in this, I'll just do the work in my fork.
[Hmmm - I have a couple of github identities, I used my work one here - you can see my other personal projects under 'dhoerl']
The text was updated successfully, but these errors were encountered:
I have a huge file on the web that I need to parse, and would really rather do it by parsing it as its read, rather than downloading it. I looked at your NSInputStream, but you don't use the delegate, and its unclear how NSInputStream would operate if given a direct URL - since it manages a runloop I guess it just blocks CHCSVParser when it asks for data and there is none.
So I looked at your code and wondered about trying to wire in a NSInputStream delegate - I guess anything is possible - but that means I have to create a background thread, add a runloop, and do all this myself (Jens A has a nice thread that Quinn responded to on the networking listserv a few years ago).
Another idea came to mind, one that would allow the use of GCD directly. Instead of using a NSInputStream, you'd use a NSObject that conforms to a protocol comprised of your current use of NSInputStream. Then, I'd create another object that meets that protocol too - but uses GCD to essentially block when 'hasData...' or 'read...' is called. This would be really simple and clean, no NSThread or runloop.
My reason for asking here is that if you would consider accepting a pull request, I'll do all the work and when its working well in my production environment, I'll issue a pull request. However, if you have no interest in this, I'll just do the work in my fork.
[Hmmm - I have a couple of github identities, I used my work one here - you can see my other personal projects under 'dhoerl']
The text was updated successfully, but these errors were encountered: