//to read a file: import java.io.*; import java.util.*; import java.util.zip.*; String fname = "C:\\test.zip" ZipFile zf = new ZipFile(fname) zf.entries().each { entry -> if (!entry.directory) { String entryFileName = entry.name println entryFileName InputStream inp = zf.getInputStream(entryFileName); inp.eachLine { line -> println line } } } //to write a file: new AntBuilder().zip(destfile:"zipped.zip", basedir=".", excludes="lib .svn plugins *.class") //http://groovy-almanac.org/creating-a-zipfile-with-antbuilder/
No comments:
Post a Comment