testwriter.java

来自「这是java 字符流对象的简单比较的源码例子。希望能帮组学java的朋友」· Java 代码 · 共 24 行

JAVA
24
字号
import java.io.*;

public class TestWriter {
	public static void main(String[] args) {
		FileInputStream in = null;
		FileOutputStream out = null;
		try {
			in = new FileInputStream("d:\\a.txt");
			InputStreamReader is = new InputStreamReader(in);
			out = new FileOutputStream("d:\\share\\jproject\\io\\b.txt");
			OutputStreamWriter os = new OutputStreamWriter(out);
			int b = 0;
			while((b=in.read()) != -1) {
				os.write(b);
			}
			is.close();
			os.close();
		}catch(FileNotFoundException e) {
			System.out.println("the file is not found !!!");
		}catch(IOException e) {
			System.out.println("the IO system is error!!");
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?