Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement