?? batch.java
字號:
package agenda.command;import agenda.Exception.*;import java.io.*;import java.util.*;/** * Batch command * @author wc */public class BATCH implements Command{ String fileName; /** * Command parse method * @param args * @throws agenda.Exception.InvalidCommandException */ public void parse(String[] args) throws InvalidCommandException { if(args.length != 2) throw new InvalidCommandException("batch"); fileName = args[1]; } /** * Command execute method * @throws java.lang.Exception */ public void execute() throws Exception { try{ String command = new String(); CommandFactory factory = new CommandFactory(); try{ FileInputStream fis = new FileInputStream(fileName); Scanner cin = new Scanner(fis); while(cin.hasNextLine()){ command = cin.nextLine(); if(command.isEmpty()) continue; try{ factory.getCommand(command).execute(); } catch(Exception e){ System.out.println(e.toString()); } } } catch(FileNotFoundException fnfe){ throw new InputFileNotFoundException(fileName); } } catch(Exception e){ throw e; } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -