15. 获取类路径下文件对应的输入流(inputStream)方式

Posted on 2019-12-25 16:15  zkx4213  阅读(3342)  评论(0编辑  收藏  举报

//获取 inputStream 方式一
Resource resource = new ClassPathResource("excel/template/test.xlsx");
InputStream inputStream = resource.getInputStream();


//获取 inputStream 方式二
InputStream inputStream = TestController.class.getResourceAsStream("/excel/template/test.xlsx");

Copyright © 2024 zkx4213
Powered by .NET 9.0 on Kubernetes