程序包 dev.utils.common

类 ZipUtils

java.lang.Object
dev.utils.common.ZipUtils

public final class ZipUtils extends Object
detail: 压缩相关工具类
作者:
Ttt
  • 方法详细资料

    • zipFiles

      public static boolean zipFiles(Collection<String> resFiles, String zipFilePath) throws Exception
      批量压缩文件
      参数:
      resFiles - 待压缩文件路径集合
      zipFilePath - 压缩文件路径
      返回:
      true 压缩成功, false 压缩失败
      抛出:
      Exception - 异常时抛出
    • zipFiles

      public static boolean zipFiles(Collection<String> resFilePaths, String zipFilePath, String comment) throws Exception
      批量压缩文件
      参数:
      resFilePaths - 待压缩文件路径集合
      zipFilePath - 压缩文件路径
      comment - 压缩文件的注释
      返回:
      true 压缩成功, false 压缩失败
      抛出:
      Exception - 异常时抛出
    • zipFiles

      public static boolean zipFiles(Collection<File> resFiles, File zipFile) throws Exception
      批量压缩文件
      参数:
      resFiles - 待压缩文件集合
      zipFile - 压缩文件
      返回:
      true 压缩成功, false 压缩失败
      抛出:
      Exception - 异常时抛出
    • zipFiles

      public static boolean zipFiles(Collection<File> resFiles, File zipFile, String comment) throws Exception
      批量压缩文件
      参数:
      resFiles - 待压缩文件集合
      zipFile - 压缩文件
      comment - 压缩文件的注释
      返回:
      true 压缩成功, false 压缩失败
      抛出:
      Exception - 异常时抛出
    • zipFile

      public static boolean zipFile(String resFilePath, String zipFilePath) throws Exception
      压缩文件
      参数:
      resFilePath - 待压缩文件路径
      zipFilePath - 压缩文件路径
      返回:
      true 压缩成功, false 压缩失败
      抛出:
      Exception - 异常时抛出
    • zipFile

      public static boolean zipFile(String resFilePath, String zipFilePath, String comment) throws Exception
      压缩文件
      参数:
      resFilePath - 待压缩文件路径
      zipFilePath - 压缩文件路径
      comment - 压缩文件的注释
      返回:
      true 压缩成功, false 压缩失败
      抛出:
      Exception - 异常时抛出
    • zipFile

      public static boolean zipFile(File resFile, File zipFile) throws Exception
      压缩文件
      参数:
      resFile - 待压缩文件
      zipFile - 压缩文件
      返回:
      true 压缩成功, false 压缩失败
      抛出:
      Exception - 异常时抛出
    • zipFile

      public static boolean zipFile(File resFile, File zipFile, String comment) throws Exception
      压缩文件
      参数:
      resFile - 待压缩文件
      zipFile - 压缩文件
      comment - 压缩文件的注释
      返回:
      true 压缩成功, false 压缩失败
      抛出:
      Exception - 异常时抛出
    • unzipFile

      public static List<File> unzipFile(String zipFilePath, String destDirPath) throws Exception
      解压文件
      参数:
      zipFilePath - 待解压文件路径
      destDirPath - 目标目录路径
      返回:
      文件链表
      抛出:
      Exception - 异常时抛出
    • unzipFile

      public static List<File> unzipFile(File zipFile, File destDir) throws Exception
      解压文件
      参数:
      zipFile - 待解压文件
      destDir - 目标目录
      返回:
      文件链表
      抛出:
      Exception - 异常时抛出
    • unzipFileByKeyword

      public static List<File> unzipFileByKeyword(String zipFilePath, String destDirPath, String keyword) throws Exception
      解压带有关键字的文件
      参数:
      zipFilePath - 待解压文件路径
      destDirPath - 目标目录路径
      keyword - 关键字
      返回:
      带有关键字的文件链表
      抛出:
      Exception - 异常时抛出
    • unzipFileByKeyword

      public static List<File> unzipFileByKeyword(File zipFile, File destDir, String keyword) throws Exception
      解压带有关键字的文件
      参数:
      zipFile - 待解压文件
      destDir - 目标目录
      keyword - 关键字
      返回:
      带有关键字的文件链表
      抛出:
      Exception - 异常时抛出
    • getFilesPath

      public static List<String> getFilesPath(String zipFilePath) throws Exception
      获取压缩文件中的文件路径链表
      参数:
      zipFilePath - 压缩文件路径
      返回:
      压缩文件中的文件路径链表
      抛出:
      Exception - 异常时抛出
    • getFilesPath

      public static List<String> getFilesPath(File zipFile) throws Exception
      获取压缩文件中的文件路径链表
      参数:
      zipFile - 压缩文件
      返回:
      压缩文件中的文件路径链表
      抛出:
      Exception - 异常时抛出
    • getComments

      public static List<String> getComments(String zipFilePath) throws Exception
      获取压缩文件中的注释链表
      参数:
      zipFilePath - 压缩文件路径
      返回:
      压缩文件中的注释链表
      抛出:
      Exception - 异常时抛出
    • getComments

      public static List<String> getComments(File zipFile) throws Exception
      获取压缩文件中的注释链表
      参数:
      zipFile - 压缩文件
      返回:
      压缩文件中的注释链表
      抛出:
      Exception - 异常时抛出