Android文件压缩和解压(2)

来源:未知 责任编辑:责任编辑 发表时间:2013-11-15 19:49 点击:

     * @param resFileList
     *            要压缩的文件(夹)列表
     * @param zipFile
     *            生成的压缩文件
     * @param comment
     *            压缩文件的注释
     * @throws IOException
     *             当压缩过程出错时抛出
     */ 
    public static void zipFiles(Collection<File> resFileList, File zipFile, String comment) throws IOException { 
        ZipOutputStream zipout = null; 
        try { 
            zipout = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile), BUFF_SIZE)); 
            for (File resFile : resFileList) { 
                zipFile(resFile, zipout, ""); 
            } 
            zipout.setComment(comment); 
 
        } finally { 
            if (zipout != null) 
                zipout.close(); 
        } 
    } 
 
    /**
     * 解压缩一个文件
     * 
     * @param zipFile
     *            压缩文件
     * @param folderPath
     *            解压缩的目标目录
     * @throws IOException
     *             当解压缩过程出错时抛出
     */ 
    public static void upZipFile(File zipFile, String folderPath) throws ZipException, IOException { 
        File desDir = new File(folderPath); 
        if (!desDir.exists()) { 
            desDir.mkdirs(); 
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • Android 完全退出程序
  • 原创:Android应用开发-Andorid歌词秀,含源码
  • android 屏幕保护
  • Android手机软件汉化教程---第四课 dex文件汉化
  • 众多Android 开源项目推荐,给力工作给力学习
  • Android Audio代码分析4
  • Android得到已安装的应用程序信息!
  • Android开发者指南(29) —— USB Host and Accessory
  • Android成长的幕后推手:工程师鲁宾
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1