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
- 上一篇 »java基础——简单工厂模式
- 下一篇 »JavaScript-创建第一个自己的类库