showfile.java

来自「一些jsp源代码 可以帮助初学者更容易上手」· Java 代码 · 共 24 行

JAVA
24
字号
import java.io.*;
class ShowFile {
  	public static void main(String args[]) throws IOException
  	{
    		int i;
    		FileInputStream fin;
    		try {
      		fin = new FileInputStream(args[0]);
    		} catch(FileNotFoundException e) {
      		System.out.println("File Not Found");
      		return;
    		} catch(ArrayIndexOutOfBoundsException e) {
      		System.out.println("Usage: ShowFile File");
      		return;
    		}
    		// read characters until EOF is encountered
    		do {
      		i = fin.read();
      		if(i != -1) System.out.print((char) i);
    		} while(i != -1);
    		fin.close();
  	}
}

⌨️ 快捷键说明

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