Class ZipUtil

java.lang.Object
org.ofdrw.reader.ZipUtil

public class ZipUtil extends Object
ZIP 文件解压工具
  • Constructor Details

    • ZipUtil

      public ZipUtil()
  • Method Details

    • setMaxSize

      @Deprecated public static void setMaxSize(long size)
      Deprecated.
      采用apache compress 默认策略
      设置 解压许可最大字节数
      Parameters:
      size - 压缩文件解压最大大小,默认值: 100M
    • setDefaultCharset

      public static void setDefaultCharset(String charset)
      设置解压默认字符集

      用于解决中文字符集乱码问题

      Parameters:
      charset - 字符集,如 GBK、UTF8 等
    • unZipFiles

      public static void unZipFiles(String zipPath, String descDir) throws IOException
      解压到指定目录
      Parameters:
      zipPath - 需要解压的文件路径
      descDir - 解压到目录
      Throws:
      IOException - 文件操作IO异常
    • unZipFiles

      public static void unZipFiles(InputStream src, String descDir) throws IOException
      解压文件到指定目录
      Parameters:
      src - 压缩文件流
      descDir - 解压到目录
      Throws:
      IOException - 文件操作IO异常
    • unZipFiles

      public static void unZipFiles(File zipFile, String descDir) throws IOException
      解压文件到指定目录
      Parameters:
      zipFile - 需要解压的文件
      descDir - 解压到目录
      Throws:
      IOException - 文件操作IO异常
    • unZipFileByApacheCommonCompress

      public static void unZipFileByApacheCommonCompress(File srcFile, String descDir) throws IOException
      使用apache common compress库 解压zipFile,能支持更多zip包解压的特性
      Parameters:
      srcFile - 带解压的源文件
      descDir - 解压到目录
      Throws:
      IOException - IO异常
    • unZipFileByApacheCommonCompress

      public static void unZipFileByApacheCommonCompress(InputStream src, String descDir) throws IOException
      apache common compress库 解压zipFile
      Parameters:
      src - 带解压的源文件流
      descDir - 解压到目录
      Throws:
      IOException - IO异常