ReadOnlySubStream shold not throw NotSupportedException on getting Length #309

Open
opened 2026-01-29 22:09:51 +00:00 by claunia · 4 comments
Owner

Originally created by @AlexeiScherbakov on GitHub (Jun 18, 2018).

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

Originally created by @AlexeiScherbakov on GitHub (Jun 18, 2018). Even for archives without any compression ReadOnlySubStream throws exception on getting length I think it should return initial value of bytesToRead getted in constructor
Author
Owner

@jcapellman commented on GitHub (May 22, 2019):

Agreed - just hit this

@jcapellman commented on GitHub (May 22, 2019): Agreed - just hit this
Author
Owner

@adamhathcock commented on GitHub (May 22, 2019):

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

@adamhathcock commented on GitHub (May 22, 2019): 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
Author
Owner

@jcapellman commented on GitHub (May 23, 2019):

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.

@jcapellman commented on GitHub (May 23, 2019): 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.
Author
Owner

@adamhathcock commented on GitHub (May 23, 2019):

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

@adamhathcock commented on GitHub (May 23, 2019): 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 in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#309