import java.io.IOException;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/**
*
* @author Rakesh P
* ZipFile Function Accept the Path of the Zip File
*/
public class ZipContents{
public void listContentsOfZipFile() {
try {
ZipFile zipFile = new ZipFile("d:/FeedtoInterfaces.zip");
Enumeration zipEntries = zipFile.entries();
while (zipEntries.hasMoreElements()) {
//Process the name, here we just print it out
System.out.println(((ZipEntry)zipEntries.nextElement()).getName());
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
new ZipContents().listContentsOfZipFile();
}
}
Misc Java related problems I faced and solutions I found. Hope this helps other developers.
Wednesday, December 9, 2009
List The Contents of a ZIP File
This is a utility program to view the contents of a zip file
Subscribe to:
Post Comments (Atom)
1 comment:
I know a lot of types of files,but zip archives for me are quite difficult. Because of often some of them are corrupted and no one knows how. But yesterday I was in the Internet and noticed there - check integrity of zip file. It restored all my corrupted zip files. Besides the tool performed it without money.
Post a Comment