fileexe.java

来自「《Java程序设计》第6、7、8章的源代码。有需要者请」· Java 代码 · 共 34 行

JAVA
34
字号
import java.io.*;
class FileExe{
	public static void main(String args[]){
	int count;
	byte b[]=new byte[1024];
	FileInputStream fis;
	FileOutputStream fos;
	try{
		fis=new FileInputStream(args[0]);
		}
	catch(FileNotFoundException e){
		System.out.println("InputFile is not found!");
		return;
	}
	try{
		fos=new FileOutputStream(args[1]);
		}
	catch(FileNotFoundException e){
		System.out.println("OutputFile is not found!");
		return;
	  }
	catch(ArrayIndexOutOfBoundsException e){
		System.out.println();
		return;}
	try{
		while((count=fis.read(b,0,1024))!=-1)
		{fos.write(b,0,count);}
		}
	catch(IOException e){
		System.out.println("Error:"+e);
		return;
		}
	}
}

⌨️ 快捷键说明

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