public class MyfileRW {
FileWriter fileWriter=new FileWriter("333.txt");//filereader和filewriter流用的时间79
//buffer流
BufferedReader bufferedReader=new BufferedReader(fileReader);//filereader和filewriter流用的时间16
BufferedWriter bufferedWriter=new BufferedWriter(fileWriter);
int i=0;
long a=System.currentTimeMillis();//当前时间
while((i=bufferedReader.read())!=-1){
bufferedWriter.write(i);
}
long b=System.currentTimeMillis();//结束时间
fileReader.close();
fileWriter.close();
System.out.print(b-a);
}
public static void main(String[] args) throws IOException{
//filereader和filewriter流
FileReader fileReader=new FileReader("lzs.txt");FileWriter fileWriter=new FileWriter("333.txt");//filereader和filewriter流用的时间79
//buffer流
BufferedReader bufferedReader=new BufferedReader(fileReader);//filereader和filewriter流用的时间16
BufferedWriter bufferedWriter=new BufferedWriter(fileWriter);
int i=0;
long a=System.currentTimeMillis();//当前时间
while((i=bufferedReader.read())!=-1){
bufferedWriter.write(i);
}
long b=System.currentTimeMillis();//结束时间
fileReader.close();
fileWriter.close();
System.out.print(b-a);
}