/** * 文件下载 * @throws FileNotFoundException */ @RequestMapping("/bufferWriter") public void bu() throws FileNotFoundException { FileReader fileReader = new FileReader("路径"); BufferedReader bufferedReader = new BufferedReader(fileReader,1024); try { FileWriter fileWriter = new FileWriter("路径"); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); String str = null; while ((str = bufferedReader.readLine()) !=null){ bufferedWriter.write(str); bufferedWriter.write("\r\n"); } bufferedWriter.flush(); bufferedWriter.close(); bufferedReader.close(); fileReader.close(); fileWriter.close(); } catch (IOException e) { e.printStackTrace(); } }
文件下载
最新推荐文章于 2024-07-24 11:44:54 发布