Add support for seeking with non-compressed RARs #35

Open
opened 2026-01-29 22:03:45 +00:00 by claunia · 5 comments
Owner

Originally created by @ljani on GitHub (May 17, 2015).

Originally assigned to: @adamhathcock on GitHub.

It'd be nice if RARs with 0x30 (store) packing method could be seeked. That should work since that doesn't require any unpacking and can be read directly from disk. Some book keeping is needed though.

Originally created by @ljani on GitHub (May 17, 2015). Originally assigned to: @adamhathcock on GitHub. It'd be nice if RARs with `0x30` (`store`) packing method could be seeked. That should work since that doesn't require any unpacking and can be read directly from disk. Some book keeping is needed though.
claunia added the bug label 2026-01-29 22:03:45 +00:00
Author
Owner

@adamhathcock commented on GitHub (May 18, 2015):

If you open with RarArchive, can you not seek?

Or do you mean you want the Stream from RarArchive be seekable?

@adamhathcock commented on GitHub (May 18, 2015): If you open with RarArchive, can you not seek? Or do you mean you want the Stream from RarArchive be seekable?
Author
Owner

@ljani commented on GitHub (May 19, 2015):

I mean that it would be nice if the Stream from RarArchiveEntry.OpenEntryStream() would be seekable. For non-compressed rars, that shouldn't be too hard since you can read the stream directly from the file.

I thought about writing a wrapper, but you had hid the implementation details in internal classes, so I couldn't access the data in eg FileParts ;)

@ljani commented on GitHub (May 19, 2015): I mean that it would be nice if the `Stream` from `RarArchiveEntry.OpenEntryStream()` would be seekable. For non-compressed rars, that shouldn't be too hard since you can read the stream directly from the file. I thought about writing a wrapper, but you had hid the implementation details in `internal` classes, so I couldn't access the data in eg `FileParts` ;)
Author
Owner

@adamhathcock commented on GitHub (May 19, 2015):

It should be easy enough to be an if statement here: https://github.com/adamhathcock/sharpcompress/blob/master/SharpCompress/Archive/Rar/RarArchiveEntry.cs#L74

I can't remember where the store flag is.

@adamhathcock commented on GitHub (May 19, 2015): It should be easy enough to be an if statement here: https://github.com/adamhathcock/sharpcompress/blob/master/SharpCompress/Archive/Rar/RarArchiveEntry.cs#L74 I can't remember where the store flag is.
Author
Owner

@ljani commented on GitHub (May 19, 2015):

All the interesting information is hidden in FileHeader (eg. PackingMethod, CompressedSize and DataStartPosition) and is not accessible to outside. I could to reflection, but it gets a bit ugly, because everything is internal. Thus I decided against creating my own dirty wrapper and decided to ask if someone had interest to implement this properly in the library itself.

@ljani commented on GitHub (May 19, 2015): All the interesting information is hidden in [`FileHeader`](https://github.com/adamhathcock/sharpcompress/blob/dae13c782fb438e424ca224b4c103dcec216c8b1/SharpCompress/Common/Rar/Headers/FileHeader.cs) (eg. `PackingMethod`, `CompressedSize` and `DataStartPosition`) and is not accessible to outside. I could to reflection, but it gets a bit ugly, because everything is `internal`. Thus I decided against creating my own dirty wrapper and decided to ask if someone had interest to implement this properly in the library itself.
Author
Owner

@adamhathcock commented on GitHub (May 20, 2015):

It seems like you could :)

Just fork and adjust the code. It doesn't seem like it would be a big job.

@adamhathcock commented on GitHub (May 20, 2015): It seems like you could :) Just fork and adjust the code. It doesn't seem like it would be a big job.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#35