com.xiaoleilu.hutool.util.ZipUtil.unzip()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(564)

本文整理了Java中com.xiaoleilu.hutool.util.ZipUtil.unzip()方法的一些代码示例,展示了ZipUtil.unzip()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipUtil.unzip()方法的具体详情如下:
包路径:com.xiaoleilu.hutool.util.ZipUtil
类名称:ZipUtil
方法名:unzip

ZipUtil.unzip介绍

[英]解压到文件名相同的目录中,使用UTF-8编码
[中]解压到文件名相同的目录中,使用UTF-8编码

代码示例

代码示例来源:origin: com.xiaoleilu/hutool-core

  1. /**
  2. * 解压到文件名相同的目录中,默认编码UTF-8
  3. *
  4. * @param zipFilePath 压缩文件路径
  5. * @return 解压的目录
  6. * @throws UtilException IO异常
  7. */
  8. public static File unzip(String zipFilePath) throws UtilException {
  9. return unzip(zipFilePath, DEFAULT_CHARSET);
  10. }

代码示例来源:origin: com.xiaoleilu/hutool-core

  1. /**
  2. * 解压,默认使用UTF-8编码
  3. *
  4. * @param zipFile zip文件
  5. * @param outFile 解压到的目录
  6. * @return 解压的目录
  7. * @throws UtilException IO异常
  8. */
  9. public static File unzip(File zipFile, File outFile) throws UtilException {
  10. return unzip(zipFile, outFile, DEFAULT_CHARSET);
  11. }

代码示例来源:origin: com.xiaoleilu/hutool-core

  1. /**
  2. * 解压到文件名相同的目录中,使用UTF-8编码
  3. *
  4. * @param zipFile 压缩文件
  5. * @return 解压的目录
  6. * @throws UtilException IO异常
  7. * @since 3.2.2
  8. */
  9. public static File unzip(File zipFile) throws UtilException {
  10. return unzip(zipFile, DEFAULT_CHARSET);
  11. }

代码示例来源:origin: com.xiaoleilu/hutool-core

  1. /**
  2. * 解压,默认UTF-8编码
  3. *
  4. * @param zipFilePath 压缩文件的路径
  5. * @param outFileDir 解压到的目录
  6. * @return 解压的目录
  7. * @throws UtilException IO异常
  8. */
  9. public static File unzip(String zipFilePath, String outFileDir) throws UtilException {
  10. return unzip(zipFilePath, outFileDir, DEFAULT_CHARSET);
  11. }

代码示例来源:origin: com.xiaoleilu/hutool-core

  1. /**
  2. * 解压到文件名相同的目录中
  3. *
  4. * @param zipFilePath 压缩文件路径
  5. * @param charset 编码
  6. * @return 解压的目录
  7. * @throws UtilException IO异常
  8. * @since 3.2.2
  9. */
  10. public static File unzip(String zipFilePath, Charset charset) throws UtilException {
  11. return unzip(FileUtil.file(zipFilePath), charset);
  12. }

代码示例来源:origin: com.xiaoleilu/hutool

  1. /**
  2. * 解压到文件名相同的目录中
  3. *
  4. * @param zipFilePath 压缩文件路径
  5. * @return 解压的目录
  6. * @throws IOException
  7. */
  8. public static File unzip(String zipFilePath) throws IOException {
  9. return unzip(FileUtil.file(zipFilePath));
  10. }

代码示例来源:origin: com.xiaoleilu/hutool-core

  1. /**
  2. * 解压到文件名相同的目录中
  3. *
  4. * @param zipFile 压缩文件
  5. * @param charset 编码
  6. * @return 解压的目录
  7. * @throws UtilException IO异常
  8. * @since 3.2.2
  9. */
  10. public static File unzip(File zipFile, Charset charset) throws UtilException {
  11. return unzip(zipFile, FileUtil.file(zipFile.getParentFile(), FileUtil.mainName(zipFile)), charset);
  12. }

代码示例来源:origin: com.xiaoleilu/hutool

  1. /**
  2. * 解压到文件名相同的目录中
  3. *
  4. * @param zipFile 压缩文件
  5. * @return 解压的目录
  6. * @throws IOException
  7. */
  8. public static File unzip(File zipFile) throws IOException {
  9. return unzip(zipFile, FileUtil.file(zipFile.getParentFile(), FileUtil.mainName(zipFile)));
  10. }

代码示例来源:origin: com.xiaoleilu/hutool-core

  1. /**
  2. * 解压
  3. *
  4. * @param zipFilePath 压缩文件的路径
  5. * @param outFileDir 解压到的目录
  6. * @param charset 编码
  7. * @return 解压的目录
  8. * @throws UtilException IO异常
  9. */
  10. public static File unzip(String zipFilePath, String outFileDir, Charset charset) throws UtilException {
  11. return unzip(FileUtil.file(zipFilePath), FileUtil.mkdir(outFileDir), charset);
  12. }

代码示例来源:origin: com.xiaoleilu/hutool

  1. /**
  2. * 解压
  3. *
  4. * @param zipFilePath 压缩文件的路径
  5. * @param outFileDir 解压到的目录
  6. * @return 解压的目录
  7. * @throws IOException
  8. */
  9. public static File unzip(String zipFilePath, String outFileDir) throws IOException {
  10. return unzip(FileUtil.file(zipFilePath), FileUtil.mkdir(outFileDir));
  11. }

相关文章