私はそれほどナンセンスとは言いません、私はあなたに重要なコードを投稿します。特定のコードは次のとおりです。
java.io.file;インポートjava.io.fileoutputstream;インポートjava.io.io.ioexception; Import java.io.inputStream; Import java.util.Enumeration; import org.apache.tools.zip.zipentry; Import org.apache.tools.zipfile; org.springframework.transaction.annotation.transactional;/** * @date作成:2016年9月25日11:06:46 am * @version 1.0 * @since * @since 2016年9月25日11:06:46 am * @return */zipファイルパスストリング=フィルードレス= " // zipファイル減圧アドレス文字列unzipaddress = "f:// unzipfiles //"; //ディレクトリに移動してファイルファイル= new File(fileaddress)を見つけます。 zipfile zipfile = null; try {zipfile = new zipfile(file、 "gbk"); //エンコード形式を設定} catch(IOException例外){exception.printstacktrace(); system.out.println( "減圧ファイルは存在しません!"); }列挙e = zipfile.getentries(); while(e.hasmoreElements()){zipentry zipentry =(zipentry)e.nextelement(); if(zipentry.isdirectory()){string name = zipentry.getName(); name = name.substring(0、name.length() - 1);ファイルf = newファイル(unzipaddress + name); f.mkdirs(); } else {file f = new file(unzipaddress + zipentry.getName()); f.getParentFile()。mkdirs(); f.createNewfile(); inputstream is = zipfile.getInputStream(zipentry); fileoutputStream fos = new fileoutputStream(f); int length = 0; byte [] b = new byte [1024]; while((length = is.read(b、0、1024))!= -1){fos.write(b、0、length); } is.close(); fos.close(); }} if(zipfile!= null){zipfile.close(); } file.deleteonexit(); //減圧後に圧縮パッケージを削除}さて、コードはここで終了します。上記は、編集者が紹介したJava減圧ZIPファイルの重要なコードです。それがあなたに役立つことを願っています。ご質問がある場合は、メッセージを残してください。編集者は時間内に返信します。 wulin.comのウェブサイトへのご支援ありがとうございます!