欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

Java Zip,

来源: javaer 分享于  点击 17819 次 点评:165

Java Zip,



ZipOutputStream out=new ZipOutputStream(new FileOutputStream("E:/Download/Test.zip"));

ZipEntry entry1 = new ZipEntry("Test1.txt");
out.putNextEntry(entry1);
InputStream is1 = new FileInputStream("E:/Download/JavaZip/Test1.txt");
int len1 = 0;
while ((len1 = is1.read()) != -1)
out.write(len1);
is1.close();

ZipEntry entry2 = new ZipEntry("Test2.txt");
out.putNextEntry(entry2);
InputStream is2 = new FileInputStream("E:/Download/JavaZip/Test2.txt");
int len2 = 0;
while ((len2 = is2.read()) != -1)
out.write(len2);
is2.close();

out.close();

相关文章

    暂无相关文章
相关栏目:

用户点评