한 텍스트를 읽고 다른 텍스트로 쓰기

979 단어

/**
 * @category                 
 * @author liucanwen
 * @version v0.1 2011-1-13 20:16
 */
public class ReadFileLine
{
	public static void main(String[] args) throws Exception
	{
		File rfile = new File("D:/test.txt");//     
		File wfile = new File("D:/ck.txt");//     
		//     
		BufferedReader br = new BufferedReader(new InputStreamReader(
				new FileInputStream(rfile)));
		//     
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
				new FileOutputStream(wfile)));
        //    test.txt  ,   line 
		for(String line = br.readLine(); line != null; line = br.readLine())
		{
			/**
			 *                
			 * line       
			 */

			bw.write(line);//   ck.txt
			bw.newLine();//  ,  
			bw.flush();//  ,          
		}
		bw.close();
	}
}

좋은 웹페이지 즐겨찾기