public static void main(String[] args) throws IOException { //获取指定类路径下的资源:resources下的 ClassPathResource pathResource = new ClassPathResource("Io.txt"); //指定编码 EncodedResource resource = new EncodedResource(pathResource, StandardCharsets.UTF_8); //资源存放路径 String str = "D:\\**\\**\\**\\resources\\**\\FileIo.txt"; //FileCopyUtils;输入输出流 FileCopyUtils.copy(resource.getInputStream(),new FileOutputStream(str)); }
spring项目-拷贝类路径下数据到指定文件中-FileCopyUtils
于 2022-09-26 10:55:39 首次发布