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

added support of *.jar file extension in zip and unzip #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

akhikhl
Copy link

@akhikhl akhikhl commented Apr 14, 2014

It would be nice to use zip and unzip functions not only on ZIP-files, but also on JAR-files.

@timyates
Copy link
Owner

Sorry it took so long to get back to this, illness, Easter and a ton of stuff at work seem to have bogged me down for the past couple of weeks :sadpanda:

Wouldn't this require changing the underlying zip method to use JarOutputStream instead of ZipOutputStream? Maybe a separate jar/unjar method pair would be a better route?

@akhikhl
Copy link
Author

akhikhl commented Apr 22, 2014

Yeah, no problem :)

Let's analyze, what we have.
Jar(Input/Output)Stream classes differ from Zip versions only by special handling of manifest:

  • JarOutputStream accepts manifest as a parameter to constructor
  • JarInputStream has accessor getManifest

and that's it.

Since zip/unzip functions in groovy-common-extensions only talk on the level of File/Collection, manifests cannot be exposed with these functions. But I still think, that it is OK to treat JARs as ZIPs, i.e. to allow zip/unzip JAR files. Sometimes manifest does not need special treatment - it's another file being zipped/unzipped, not more. What do you think?

Separate jar/unjar methods is a good idea. But then File/Collection parameters/return results are not enough - we should give access to manifest. I'll think on possible function signatures.

@timyates
Copy link
Owner

Of course you're right 😊 (told you I'd been ill)

I'm actually wondering whether it's worth just removing the extension checking... So it will just try and treat the file as a zip no matter what it's extension is...

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