Tuesday, May 27, 2014

Help with ZipFile and ZipEntry!


So far, I know how to read the names inside the zip, but i don't have any idea about how to storage an especific file inside the zip (a.txt), in a File variable.


try{

FileInputStream ArchSelec = new FileInputStream(Dir);

ZipInputStream ZipS=new ZipInputStream(ArchSelec);

ZipFile zf = new ZipFile(Dir);

ZipEntry ze = new ZipEntry(Dir);


while((ze=ZipS.getNextEntry())!=null){

System.out.println(ze.getName());

System.out.println(ze.getSize());

}

ZipS.close();


}catch(Exception A){


JOptionPane.showMessageDialog(this, "Wrong File");

}



No comments:

Post a Comment