Unzip Archive with Groovy

前端 未结 9 1185
深忆病人
深忆病人 2020-12-15 04:00

is there a built-in support in Groovy to handle Zip files (the groovy way)?

Or do i have to use Java\'s java.util.zip.ZipFile to process Zip files in Groovy ?

相关标签:
9条回答
  • 2020-12-15 04:49

    This article expands on the AntBuilder example.

    http://preferisco.blogspot.com/2010/06/using-goovy-antbuilder-to-zip-unzip.html

    However, as a matter of principal - is there a way to find out all of the properties, closures, maps etc that can be used when researching a new facet in groovy/java? There seem to be loads of really useful things, but how to unlock their hidden treasures? The NetBeans/Eclipse code-complete features now seem hopelessly limited in the new language richness that we have here.

    0 讨论(0)
  • 2020-12-15 04:54

    AFAIK, there isn't a native way. But check out this article on how you'd add a .zip(...) method to File, which would be very close to what you're looking for. You'd just need to make an .unzip(...) method.

    0 讨论(0)
  • 2020-12-15 04:56

    Unzip using AntBuilder is good way.
    Second option is use an third party library - I recommend Zip4j

    0 讨论(0)
提交回复
热议问题