⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 batch.java

📁 简单的议程管理的小实验,包含可运行BAT文件和TEST用例
💻 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 + -