List the contents of a zip file

This snippets shows how to list the contents of a zip file.

ZipFile file = new ZipFile("test.zip")
file.entries().each { entry ->
println "${entry.getName()}"
}

This will output:

2.txt
1.txt
dir/3.txt