|
How to retrieve the contents of a ZIP file |
|
|
This Java tip illustrates a method of listing the contents of a ZIP file.
Developer may use this as a functionality for its users to first see the
contents of the ZIP file and then decompress the chosen one.
try {
// Open the ZIP file
ZipFile sourcefile = new ZipFile("source.zip");
// Enumerate each entry
for (Enumeration entries = sourcefile.entries(); entries.hasMoreElements();) {
// Get the entry name
String zipEntryName = ((ZipEntry)entries.nextElement()).getName();
}
} catch (IOException e) {
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.