色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

如何在java中實現對zip和rar文件的解壓

江奕云2年前16瀏覽0評論

如何在java中實現對zip和rar文件的解壓?

java中有zip包,可以使用

public void getZipFiles(String zipFile, String destFolder) throws IOException { BufferedOutputStream dest = null; ZipInputStream zis = new ZipInputStream( new BufferedInputStream( new FileInputStream(zipFile))); ZipEntry entry; while (( entry = zis.getNextEntry() ) != null) { System.out.println( "Extracting: " + entry.getName() ); int count; byte data[] = new byte[BUFFER]; if (entry.isDirectory()) { new File( destFolder + "/" + entry.getName() ).mkdirs(); continue; } else { int di = entry.getName().lastIndexOf( '/' ); if (di != -1) { new File( destFolder + "/" + entry.getName() .substring( 0, di ) ).mkdirs(); } } FileOutputStream fos = new FileOutputStream( destFolder + "/" + entry.getName() ); dest = new BufferedOutputStream( fos ); while (( count = zis.read( data ) ) != -1) dest.write( data, 0, count ); dest.flush(); dest.close(); } }

rar的只能用第三方api,比如junrar

https://github.com/edmund-wagner/junrar

java gis,如何在java中實現對zip和rar文件的解壓