Java 中.ZipOutputStream 转成 ZipInputStream 文件流.!
拿到这个ZipOutputStream后,如何转成ZipInputStream流;省略一部分代码....zipOutputStream.putNextEntry(newZ...
拿到这个ZipOutputStream 后,如何转成ZipInputStream流;
省略一部分代码....
zipOutputStream.putNextEntry(new ZipEntry("C:\\TestZip.zip")); // 生成下一个压缩节点
FileInputStream in = new FileInputStream(new File("C:\\report\\")); // 读取文件内容
int b;
while ((b = in.read()) != -1)
zipOutputStream.write(b); // 写入到压缩包
in.close(); 展开
省略一部分代码....
zipOutputStream.putNextEntry(new ZipEntry("C:\\TestZip.zip")); // 生成下一个压缩节点
FileInputStream in = new FileInputStream(new File("C:\\report\\")); // 读取文件内容
int b;
while ((b = in.read()) != -1)
zipOutputStream.write(b); // 写入到压缩包
in.close(); 展开
2个回答
展开全部
FileInputStream in = new FileInputStream(new File("C:\\TestZip.zip")); // 读取文件内容
ZipInputStream zipInputStream = new ZipInputStream(in);
zipInputStream.getNextEntry(); //取得下一个entry
while ((b = zipInputStream.read()) != -1) { //读
System.out.println(b);
}
ZipInputStream zipInputStream = new ZipInputStream(in);
zipInputStream.getNextEntry(); //取得下一个entry
while ((b = zipInputStream.read()) != -1) { //读
System.out.println(b);
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询