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

Allow seeking a PartialInputStream to the very end. #467

Merged
merged 1 commit into from
Jun 19, 2020

Conversation

Helios-vmg
Copy link
Contributor

This is useful when passing the object to C code, as applications often seek() to the end and tell() to find out the length of a stream.

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

@Numpsy
Copy link
Contributor

Numpsy commented May 23, 2020

Hmm, does the current code throw if you do Seek(0, SeekOrigin.End)? (Doesn't seem right if so)

(/Wonders if it should really be throwing at all when you try to seek past the end at all - reading the MS Docs to remind myself, it says Seeking to any location beyond the length of the stream is supported, so perhaps it shouldn't)

@Helios-vmg
Copy link
Contributor Author

Yes, it does throw on Seek(0, End). I think, particularly for an input stream, throwing when seeking beyond the end is useful to detect errors early.

@piksel piksel merged commit 4d8c4a9 into icsharpcode:master Jun 19, 2020
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.

3 participants