
UnzipMe.java
By:
NoSalt on
Apr 12th, 2012 | syntax:
Java 5 | size: 0.83 KB | hits: 30 | expires: Never
import java.io.FileInputStream;
import java.io.IOException;
import java.util.zip.ZipInputStream;
import java.io.FileNotFoundException;
import java.util.zip.ZipEntry;
public class UnzipMe{
public static void main(String[] args){
FileInputStream fis = null;
ZipEntry ze = null;
if(args.length != 0){
try{
fis = new FileInputStream(args[0]);
ZipInputStream zis = new ZipInputStream(fis);
try{
while((ze = zis.getNextEntry()) != null){
if(!ze.isDirectory()){
System.out.println(ze.getName());
}
}
} catch(IOException ioe){
System.out.println("Something hinkey happened ...");
}
} catch(FileNotFoundException fnfe){
System.out.println("Please input a valid ZIP file.");
}
} else{
System.out.println("Please supply a file name.");
}
}
}