JAvaルーチン練習(文字ストリーム)


import java.io.*;

public class TestFileReader {
	public static void main(String[] args) {
		FileReader fr = null;
		int c = 0;
		try {
			fr = new FileReader("C:/java/Test.java");
			
			while((c = fr.read()) != -1) {
				System.out.print((char)c);
			}
			fr.close();
		} catch (FileNotFoundException e) {
			System.out.println("       ");
		} catch (IOException e) {
			System.out.println("      ");
		}
	}
}
import java.io.*;


public class TestFileWriter {
	public static void main(String[] args) {
		FileWriter fw = null;
		
		try {
			fw = new FileWriter("C:/java/unicode.txt");
			for(int c = 0; c <= 50000; c++) {
				fw.write(c);
			}
			fw.close();
		} catch (IOException e) {
			System.out.println(e.getMessage());
			System.out.println("      ");
			System.exit(-1);
		}
	}
}