/*
*流 内容多 但是重在理解 看API函数调用其方法就好
*/
import java.io.*;
public class TestFileWriter
{
public static void main(String[] args)
{
FileReader r = null;
FileWriter w = null;
int d = 0;
try{
r = new FileReader("F:/java/chapter7containor/TestIterator.java");
w = new FileWriter("F:/java/io/out1.java");
while((d=r.read())!=-1)
{
w.write(d);
}
r.close();
w.close();
}catch(FileNotFoundException e1){
System.out.println("文件没有找到");
System.exit(-1);
}catch(IOException e2){
System.out.println("文件复制失败");
}
System.out.println("文件复制成功");
}
}
*流 内容多 但是重在理解 看API函数调用其方法就好
*/
import java.io.*;
public class TestFileWriter
{
public static void main(String[] args)
{
FileReader r = null;
FileWriter w = null;
int d = 0;
try{
r = new FileReader("F:/java/chapter7containor/TestIterator.java");
w = new FileWriter("F:/java/io/out1.java");
while((d=r.read())!=-1)
{
w.write(d);
}
r.close();
w.close();
}catch(FileNotFoundException e1){
System.out.println("文件没有找到");
System.exit(-1);
}catch(IOException e2){
System.out.println("文件复制失败");
}
System.out.println("文件复制成功");
}
}