JAVA ZIP 处理文件
压缩文件
public static void main(String[] args) throws IOException { String filePath = "E:\\技术部员工工作"; ZipOutputStream outputStream = new ZipOutputStream(new FileOutputStream("E:\\技术部员工工作\\aaa.zip")); ZipEntry entry = new ZipEntry("dadsa.txt"); byte[] d = FileUtils.readFileToByteArray(new File(filePath + "\\20140417.txt")); outputStream.putNextEntry(entry); outputStream.write(d); outputStream.closeEntry(); //outputStream.closeEntry(); ZipEntry entry1 = new ZipEntry("da1dsa.txt"); byte[] d1 = FileUtils.readFileToByteArray(new File(filePath + "\\20140916.txt")); outputStream.putNextEntry(entry1); outputStream.write(d1); outputStream.closeEntry(); outputStream.finish(); outputStream.close(); }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。