创建压缩文件,并添加压缩的内容
public static void saveZipFile(){
try {
ZipOutputStream zipout = new ZipOutputStream(new FileOutputStream("E:\\wangjing.zip"));
zipout.setEncoding("utf8");
zipout.putNextEntry(new ZipEntry("aaa/aa.json"));//往压缩包里添加aaa目上录和aaa目录下的aa.json,并将helloworld写入aaa.json
zipout.write("helloworld".getBytes());
zipout.close();
} catch (Exception e) {
e.printStackTrace();
}
}