java創建一個空白zip


 

String zipath = localpath+zipname+".zip";

public static void createNewzip(String zipath) throws Exception {
ZipOutputStream zoutput = null;
try {
File file = new File(zipath);
if(!file.exists())
file.createNewFile();
FileOutputStream fOutputStream = new FileOutputStream(file);
zoutput = new ZipOutputStream(fOutputStream);

} catch (Exception e) {
e.printStackTrace();
}finally{
zoutput.closeEntry();
zoutput.close();
}
}

在localpath下面生成一個名為zipname的zip


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM