Java IO文字ストリームコピーテキストファイル

740 ワード

package io.charstream.test;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/*
 *   :  : c            d 
 * 
 *  :
 *1      
 *2              
 *3                
 * 
 */
public class CopyTextTest_2 {

	public static void main(String[] args) throws IOException {
		//
		/*
		 *   :
		 *     
		 *   c       
		 *         d   
		 *     
		 */
		
		//1                          
		FileReader fr=new FileReader("c://IO .txt");	
		//2                 、
		FileWriter fw=new FileWriter("d://copytext.txt");
		//3        。
		int ch=0;
		while((ch=fr.read())!=-1) {
			fw.write(ch);
		}
		//4    
		fw.close();
		fr.close();
		
	}

}