/**
* 导入压缩文件
*
* @param file
* @param charsetName
* @param consumer
*/
public static void importZipFile(MultipartFile file, String charsetName, ThrowExceptionBiConsumer<ZipInputStream, ZipEntry> consumer)
{
try (ZipInputStream zipInputStream = new ZipInputStream(file.getInputStream(), Charset.forName(charsetName)))
{
while (true)
{
ZipEntry nextEntry = zipInputStream.getNextEntry(); if (nextEntry == null)
{
break;
} consumer.accept(zipInputStream, nextEntry);
}
}
catch (Exception e)
{
log.error(e.getMessage(), e);
throw new BaseException(e.getMessage(), e);
}
}
/**
* 抛出异常函数接口
*
* @author
* @date 2021/5/13
*/
@FunctionalInterface
public interface ThrowExceptionBiConsumer<T, U>
{
/**
* 对给定参数执行此操作
*
* @param t
* @param u
* @throws Exception
*/
void accept(T t, U u) throws Exception;
}

最新文章

  1. iOS之在webView中引入本地html,image,js,css文件的方法 - sky//////////////////////////////////////ZZZZZZZZZZZZZZZ
  2. interview que
  3. 大话设计模式C++版——代理模式
  4. LR接口测试手工脚本与验证脚本
  5. C#的winform拼数字游戏
  6. zy 送画
  7. thinkphp ajax 实例 实现
  8. 关于chrome浏览器更新后快捷工具失效的解决方法
  9. T-SQL变量
  10. ajax 中文乱码
  11. Android App监听软键盘按键的三种方式(转)
  12. CF585E. Present for Vitalik the Philatelist [容斥原理 !]
  13. JAVA简便解析json文件
  14. Go语言Context(设计及分析)
  15. Nginx服务器中的Socket切分,需要的朋友可以参考下
  16. 18.7 修改IP地址
  17. MIUI通过xposed自动设置root权限
  18. 文件I/O操作
  19. [转]如何远程连接运行OpenGL/Cuda 等GPU程序
  20. mongodb副本集升级步骤

热门文章

  1. 08-通用Service接口
  2. C语言读写txt文件
  3. overflow_auto在flex_1的容器失效
  4. 3、swagger调试
  5. Kali-Linux-for-Docker
  6. Java8时间日期处理新特性
  7. Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level
  8. mysql基础命令语法
  9. [深度探索C++对象模型]trival constructor和non-trival constructor
  10. LCD副屏-CPU,内存,时显,日期显示