| | |
| | | private final static Log log = LogFactory.getLog(ZipHelper.class); |
| | | |
| | | /** |
| | | * 解压缩 |
| | | * Zip解压 |
| | | * |
| | | * @param filePath zip文件 |
| | | * @param zipDir 解压路径 |
| | |
| | | |
| | | return true; |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage() + ex.getStackTrace() + "\n"); |
| | | log.error(ex.getMessage(), ex); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * Zip压缩 |
| | | * |
| | | * @param zipFile Zip源文件 |
| | | * @param zipFile zip源文件 |
| | | * @param sourceDir 源文件夹 |
| | | * @return 成功是/否 |
| | | */ |
| | |
| | | |
| | | return true; |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage() + ex.getStackTrace() + "\n"); |
| | | log.error(ex.getMessage(), ex); |
| | | return false; |
| | | } finally { |
| | | try { |
| | |
| | | zos.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage() + e.getStackTrace() + "\n"); |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * Zip压缩 |
| | | * |
| | | * @param sourceFile Zip源文件 |
| | | * @param zos Zip输出流 |
| | | * @param name Zip文件名称 |
| | | * @param sourceFile zip源文件 |
| | | * @param zos zip输出流 |
| | | * @param name zip文件名称 |
| | | * @throws Exception |
| | | */ |
| | | public static void compress(File sourceFile, ZipOutputStream zos, String name) throws Exception { |