Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thoughts on providing SAX style parsing #84

Open
ghost opened this issue May 5, 2015 · 0 comments
Open

Thoughts on providing SAX style parsing #84

ghost opened this issue May 5, 2015 · 0 comments

Comments

@ghost
Copy link

ghost commented May 5, 2015

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']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants