package newjava01;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
public class test05 {
public static void main(String[] args) throws IOException {
FileInputStream fi = new FileInputStream("F:\\abc.txt");
FileOutputStream fw = new FileOutputStream("F:\\ab.txt");
FileReader fa=new FileReader("F:\\ab.txt");
int ch = 0;
int a=0;
// 缓冲区b,大小为1024
byte b[] = new byte[1024];
while ((ch = fi.read(b)) != -1) {// 把fi每次读取的内容放到缓冲区b中
// 把缓冲区的内容放到fw,大小为从0到ch
fw.write(b, 0, ch);
System.out.println(ch);
}
//打印出ab.txt的内容
while((a=fa.read())!=-1){
System.out.print((char)a);
}
fi.close();
fw.close();
}
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
public class test05 {
public static void main(String[] args) throws IOException {
FileInputStream fi = new FileInputStream("F:\\abc.txt");
FileOutputStream fw = new FileOutputStream("F:\\ab.txt");
FileReader fa=new FileReader("F:\\ab.txt");
int ch = 0;
int a=0;
// 缓冲区b,大小为1024
byte b[] = new byte[1024];
while ((ch = fi.read(b)) != -1) {// 把fi每次读取的内容放到缓冲区b中
// 把缓冲区的内容放到fw,大小为从0到ch
fw.write(b, 0, ch);
System.out.println(ch);
}
//打印出ab.txt的内容
while((a=fa.read())!=-1){
System.out.print((char)a);
}
fi.close();
fw.close();
}
}