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

Fix problems with ZipReader #52

Merged
merged 9 commits into from
Apr 15, 2012
Merged

Fix problems with ZipReader #52

merged 9 commits into from
Apr 15, 2012

Conversation

ctrueden
Copy link
Member

@ctrueden ctrueden commented Apr 5, 2012

Back in October, some problems were reported on fiji-devel with the ZipReader. I fixed them shortly thereafter, but the changes fell through the cracks and were never fully tested or merged back to develop.

Fortunately, I recently rescued the topic branch, and just now rebased it over the latest develop. It worked fine, and still builds. All that remains is run the changes through the usual tests.

For further details, see:
https://groups.google.com/d/msg/fiji-devel/lZxNR00qYu8/3QcrmxY54h0J

This constructor provides the ability to retain an associated file path
even when providing an explicit IRandomAccess handle as well.
Sometimes the functionality provided by Location.getHandle is needed,
but without enabling wrapping the handle in a zip/gzip/bzip2 decoder.

For example, ZipReader uses it to get a raw input stream on a zip
source, regardless of whether that zip is from disk or a remote URL.
The issue was that RandomAccessInputStream(String) will convert a zip
file into a ZipHandle using Location.getHandle(String), but the
ZipReader was assuming that RAIS would be feeding it raw data from the
zip file itself.

The fix forces the RAIS to create a raw handle rather than a ZipHandle.
This field already exists as protected in the superclass.
This simplifies the code in ZipHandle and avoids hardcoding URLHandle
and NIOFileHandle as the only possibilities for handle resolution.
This refactors a common while loop to its own seekToEntry() method, and
merges the entry location and counting code to a single loop to reduce
the number of iterations through the zip stream.
melissalinkert added a commit that referenced this pull request Apr 15, 2012
Fix problems with ZipReader
@melissalinkert melissalinkert merged commit 301766b into ome:develop Apr 15, 2012
hflynn pushed a commit to hflynn/bioformats that referenced this pull request Oct 11, 2013
Fix section about labels in README.txt
melissalinkert pushed a commit to melissalinkert/bioformats that referenced this pull request Jan 11, 2018
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

Successfully merging this pull request may close these issues.

2 participants