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

Added PFFileDataStream for streaming file Downloads. #241

Merged
merged 1 commit into from
Sep 29, 2015

Conversation

richardjrossiii
Copy link
Contributor

This is an NSInputStream proxy that is used for file downloads while concurrently reading and writing to a file. This allows us to truly stream from parse using -[PFFile getDataDownloadStreamInBackground], whereas before it had the potential to break if you consumed it too fast.

@richardjrossiii richardjrossiii added this to the 1.8.5 milestone Sep 12, 2015
@richardjrossiii richardjrossiii force-pushed the richardross.inputstream.minusonebyte branch 4 times, most recently from a6706cc to 8e5f379 Compare September 14, 2015 23:51
@nlutsenko nlutsenko modified the milestones: 1.9.0, 1.8.5, 1.8.6 Sep 17, 2015

/*!
@abstract Why? Because Nikita.
@discussion Actually, this does have some practical use. When downloading a file stream via
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember precisely, but I think these annotations are simply ignored for class documentation.

@nlutsenko
Copy link
Contributor

Looks great, minus nits.
Don't really have a good name for this class, sorry... You can name it anything, but please prefix with PF.

The only question about this that I have - what is the expected behavior for using this stream with getBuffer:length:? It will simply call through into the actual stream, just wondering what are the things people can run into.

@richardjrossiii
Copy link
Contributor Author

getBuffer:length: is not implemented (and probably will never be) for the built-in NSInputStream classes, and the docs aren't clear how it should be used in any case (e.g. whether this buffer already has contents, or whether you should call -read:maxLength: after getting the buffer).

According to this mailing list it would appear that you should still call -read:maxLength:, but according to this, it would appear you should not.

Seeing as apple has never used this themselves and probably never will due to the API confusion surrounding it, I think it's safe enough to ignore this for now.

@nlutsenko
Copy link
Contributor

Sounds great! Fix nits and let's ship!

@nlutsenko
Copy link
Contributor

Please rename before shipping. As much as I love the name (it has my name in it :D), not sure if other people will understand this.

This is an NSInputStream proxy that is used for file downloads while concurrently reading and writing to a file. This allows us to truly stream from parse using `-[PFFile getDataDownloadStreamInBackground]`, whereas before it had the potential to break if you consumed it too fast.
@richardjrossiii richardjrossiii force-pushed the richardross.inputstream.minusonebyte branch from 218d074 to 9fac0f8 Compare September 29, 2015 00:23
@richardjrossiii richardjrossiii changed the title Added NikitaInputStream for streaming file Downloads. Added PFFileDataStream for streaming file Downloads. Sep 29, 2015
richardjrossiii added a commit that referenced this pull request Sep 29, 2015
…nusonebyte

Added PFFileDataStream for streaming file Downloads.
@richardjrossiii richardjrossiii merged commit 993fad0 into master Sep 29, 2015
@richardjrossiii richardjrossiii deleted the richardross.inputstream.minusonebyte branch September 29, 2015 06:05
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

Successfully merging this pull request may close these issues.

None yet

3 participants