public static void main1(String[] args) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 10000; i++) {
sb.append("看**人物委琐,举止粗糙 \n");
}
try {
//此处后缀可以为rar也可为zip
ZipOutputStream out = new ZipOutputStream(new FileOutputStream("c:/abc.rar"));
ZipEntry entry = new ZipEntry("abc.txt");
out.putNextEntry(entry);
out.write(sb.toString().getBytes());
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
用程序创建zip或rar压缩包
最新推荐文章于 2022-02-25 20:00:37 发布