public class CopyJavaDome02 {
public static void main(String[] args) throws IOException {
FileReader fr = new FileReader(“D:\IDEA\src\JavaHeiMa02\src\字符流CharStream\字符流输入流读数据\InputStreamReaderDome01.java”);
FileWriter fw = new FileWriter(“D:\IDEA\src\JavaHeiMa02\src\字符流CharStream\字符流复制文件\Copy.txt”);
//一次读写一个字符
// int ch;
// while ((ch = fr.read())!=-1){
// fw.write(ch);
// }
//一次读写一个数组
char[] chs = new char[1024];
int len;
while ((len=fr.read(chs))!=-1){
fw.write(chs,0,len);
}
fr.close();
fw.close();
}
}