- import java.io.BufferedReader;
- import java.io.BufferedWriter;
- import java.io.FileReader;
- import java.io.FileWriter;
- import java.io.IOException;
- public class Test2 {
- /**
- * @param args
- * @throws IOException
- */
- public static void main(String[] args) throws IOException {
- FileReader fr = new FileReader("E:\\iLove\\You\\xxx.txt");//字符输入流封装要输入的文件路径
-
- FileWriter fw = new FileWriter("E:\\iLove\\You\\yyy.txt");//<span style="line-height: 30.8px;">字符输出流封装要输出的文件路径</span>
-
- BufferedReader br = new BufferedReader(fr);//字符缓冲流包装<span style="line-height: 30.8px;">字符输入流对象</span>
- BufferedWriter bw = new BufferedWriter(fw);
- int a;
- while((a = br.read()) != -1) {
- bw.write(a);
- }
-
- br.close();
- bw.close();
- }
- }
复制代码
|
|