sharpcompress
sharpcompress copied to clipboard
Added Seeking feature for BufferedSubStream and ReadOnlySubStream.
Added the seeking feature for BufferedSubStream and ReadOnlySubStream. When the compression type of an entry is Store (uncompressed) in the Zip or APK file, a seekable stream will be obtained by entry.OpenEntryStream(). In game development on the Android platform, it avoids having to decompress files to disk due to a seekable stream being required.
Hi,@adamhathcock My submission failed to pass the test case, but this does not seem to be my problem. I tested some cases in which errors were reported on my computer, and it worked.
Not sure how these pass locally for you as some of the code looks at the CanSeek
flags to do different things. That's why the test is failing because ReadOnlySubStream
was never seekable and now RewindableStream
blows up because it's trying to seek.
I believe entry.OpenEntryStream()
should always return a non-seekable stream as it's directly linked to decompression and inheritly shouldn't be seekable. If you want to buffer it for your app, do so, but I don't think this is something that should be part of SharpCompress.
Not sure how these pass locally for you as some of the code looks at the
CanSeek
flags to do different things. That's why the test is failing becauseReadOnlySubStream
was never seekable and nowRewindableStream
blows up because it's trying to seek.I believe
entry.OpenEntryStream()
should always return a non-seekable stream as it's directly linked to decompression and inheritly shouldn't be seekable. If you want to buffer it for your app, do so, but I don't think this is something that should be part of SharpCompress.
Usually, entry.OpenEntryStream() gets a compressed stream that cannot be seeked, but in the zip file, if the Entry is a "Store" type, it is not compressed. In the game developed with Unity3d (Android APK), The files in the StreamingAssets directory are game resource files. They are all "Store" types and are not compressed. It is necessary to support a seekable stream. And when using SharpZipLib, it works.So could you support this feature? Thanks you.
I guess if there's no decompression stream, then it could be a seekable stream when using OpenEntryStream. Just need to complete the thread and check for uncompressed streams in zips
I guess if there's no decompression stream, then it could be a seekable stream when using OpenEntryStream. Just need to complete the thread and check for uncompressed streams in zips
Yes, it is seekable, but it is wrapped by ReadOnlySubStream in sharpcompress, so i added the seeking feature to ReadOnlySubStream