mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-08 05:27:04 +00:00
ReadOnlySubStream shold not throw NotSupportedException on getting Length #309
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
@jcapellman commented on GitHub (May 22, 2019):
Agreed - just hit this
@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
@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.
@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