dss-99
 1 //将两个文本文件合并到一个文件中去
 2 package classwork10;
 3 
 4 import java.io.BufferedInputStream;
 5 import java.io.File;
 6 import java.io.FileInputStream;
 7 import java.io.IOException;
 8 import java.io.PrintWriter;
 9 
10 public class Hebing {
11 
12     public static void main(String[] args) throws IOException {
13     BufferedInputStream bf=new BufferedInputStream(new FileInputStream(new File("D:/dssjava/result1.txt")));
14     byte[] buf=new byte[bf.available()];
15     bf.read(buf);
16     BufferedInputStream bf1=new BufferedInputStream(new FileInputStream(new File("D:/dssjava/result.txt")));
17     byte[] buf1=new byte[bf1.available()];
18     bf1.read(buf1);
19     PrintWriter pw=new PrintWriter("D:/dssjava/result.txt");
20     pw.println(new String(buf)+new String(buf1));
21     bf.close();
22     bf1.close();
23     pw.close();
24     System.out.println("操作已完成");
25     }
26 
27 }

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-02-07
  • 2021-12-04
  • 2021-07-03
  • 2022-02-04
  • 2021-12-29
  • 2022-02-11
  • 2022-01-23
猜你喜欢
  • 2021-12-26
  • 2021-05-27
  • 2022-01-03
  • 2022-01-17
  • 2021-11-29
  • 2022-01-02
  • 2021-12-17
相关资源
相似解决方案