首页 > 代码库 > JAVA ZIP 处理文件

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();    }

 

JAVA ZIP 处理文件