import java.io.*; import java.util.zip.*; import java.util.Date; class LoeZip2{ public static void main(String argumendid[]) throws Exception{ String failinimi=""; if(argumendid.length>0){ failinimi=argumendid[0]; } else { System.out.println("Kasuta : java LoeZip2 failinimi.zip"); System.exit(1); } ZipInputStream zin=new ZipInputStream(new FileInputStream(failinimi)); ZipEntry ze=zin.getNextEntry(); while(ze!=null){ System.out.println("\nNimi: "+ze.getName()+" "+ze.getSize()+" "+ ze.getCompressedSize()+" "+new Date(ze.getTime()).toString()); if(ze.isDirectory()){ new File(ze.getName()).mkdirs(); } else { String nimi=ze.getName(); FileOutputStream fos=new FileOutputStream(nimi); int nr=zin.read(); while(nr!=-1){ fos.write(nr); nr=zin.read(); } fos.close(); } ze=zin.getNextEntry(); } } }