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

ReadOnlySubStream shold not throw NotSupportedException on getting Length #392

Open
AlexeiScherbakov opened this issue Jun 18, 2018 · 4 comments

Comments

@AlexeiScherbakov
Copy link

Even for archives without any compression ReadOnlySubStream throws exception on getting length
I think it should return initial value of bytesToRead getted in constructor

@jcapellman
Copy link

Agreed - just hit this

@adamhathcock
Copy link
Owner

Not sure I agree. The intention is that streams are forward only. Header information would have length if you needed it.

Willing to look at a PR

@jcapellman
Copy link

The use case for me was upon inspecting archives within an archive to determine what file type it was using a cigam check (i.e. reading the first couple bytes) I was attempting to set position to 0 afterwards so I could do further processing of the stream.

@adamhathcock
Copy link
Owner

I do the same in ReaderFactory with RewindableStream which is built for this use case on forward only streams: https://github.com/adamhathcock/sharpcompress/blob/master/src/SharpCompress/Readers/ReaderFactory.cs

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

3 participants