byte[] buffer = newbyte[1024]; int len; while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); } fos.close();
} } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ try { if(zis != null) zis.close(); } catch (IOException e) { // TODO: handle exception } } System.out.println("Decompression From Zip is Success."); }
}
运行结果:
1 2 3 4 5 6
File Name : 1\1.txt File Name : 2\3\New Text Document.txt File Name : 2.txt File Name : 5.pdf File Name : sudent.txt Decompression From Zip is Success.