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