package FileSystem; /** * FileSystem is intended to handle the high-level work, including handling user * commands. You are not required to use anything in this class, although this * class must contain your project's main method. * * @author * */ public class FileSystem { InputSource in; public FileSystem(InputSource i) { in = i; } /** * command takes in a string that inputed by the user, parses it, and * processes it accordingly. This method should contain no more than 40 * lines of code, although you can certainly do it with much less. * * @param s * The user input. */ public void command(String[] s) { if (s == null) exit(0); } /** * This uses the InputSource to get strings one line at a time. */ public static void main(String[] args) { InputSource in; if (args.length == 0) { in = new InputSource(); } else { in = new InputSource(args[0]); } FileSystem fs = new FileSystem(in); String[] strings; while (true) { strings = in.nextLine(); fs.command(strings); } } /** * The Following methods are provided for student testing. */ /** * Exit from the program. When the testing state is true, throws * ExitException with the given CODE as parameter. Otherwise, behaves just * like System.exit. For this all to work, other parts of the program should * not call System.exit directly. */ static void exit(int code) { throw new ExitException(code); } }