public class TestIO2 {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
BufferedReader br = null;
BufferedWriter bw = null;
String str=null;
br = new BufferedReader(new InputStreamReader(new FileInputStream("d:/Test/in.txt")));
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("d:/Test/out.txt")));
str = br.readLine();
while(str!=null)
{
System.out.println(str);
bw.write(str);
bw.flush();
str = br.readLine();
}
}
} |