复制代码代码如下:
import java.io.BufferedInputStream;
import java.io.BufferedReader;
java.io.File importieren;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
öffentliche Klasse Qukonghang {
privater statischer String Dateiname1;
privater statischer String Dateiname2;
public static void main(String[] args) {
Dateiname1="Datei1";
Dateiname2="Datei2";
Datei file=new File(filename1);
InputStream ist=null;
BufferedReader br = null;
String tmp;
FileWriter-Writer=null;
int i=0;
versuchen {
is=new BufferedInputStream(new FileInputStream(file));
br = new BufferedReader(new InputStreamReader(is, "utf-8"));
writer = new FileWriter(filename2, true);
while((tmp=br.readLine())!=null){
if(tmp.equals(""));
anders{
write.write(tmp+"/n");
i++;
System.out.println(i);
}
}
Writer.close();
is.close();
} Catch (IOException e) {
e.printStackTrace();
}
}
}