fileoutputstream1.java

来自「这是java io流的一个通信小程序」· Java 代码 · 共 31 行

JAVA
31
字号
import java.io.*;

public class FileOutputStream1 {
	public static void main(String[] args) {
		FileInputStream fin = null;
		FileOutputStream fout = null;
		try {
			fin = new FileInputStream("d:\\a.txt");
		}catch(FileNotFoundException e) {
			System.out.println("the file is not found!!");
		}
		
		try {
			fout = new FileOutputStream("d:\\share\\jproject\\io\\b.txt");
			int b = 0;
			
			while((b=fin.read()) != -1) {
				fout.write(b);
			}
			fin.close();
			fout.close();
			
			
		}catch(FileNotFoundException e) {
			System.out.println("the file is not found too!!");
		}catch(IOException e) {
			System.out.println("the Io Exception !!");
		}
		
	}
}

⌨️ 快捷键说明

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