@Test @SuppressWarnings("resource") public void testScanFilePath() { testScanFilePath(new Scanner("/var/Compile-Test Build/workspace/policy1.xml"), "/var/Compile-Test", "Build/workspace/policy1.xml"); testScanFilePath(new Scanner("'/var/Compile-Test Build/workspace/policy1.xml'"), "/var/Compile-Test Build/workspace/policy1.xml", null); testScanFilePath(new Scanner("\"/var/Compile-Test Build/workspace/policy1.xml\""), "/var/Compile-Test Build/workspace/policy1.xml", null); testScanFilePath(new Scanner("'/var/Compile-Test Build/workspace/policy1.xml' extra"), "/var/Compile-Test Build/workspace/policy1.xml", "extra"); testScanFilePath(new Scanner("'/var/Compile-Test Build/workspace/policy1.xml\" extra'"), "/var/Compile-Test Build/workspace/policy1.xml\" extra", null); }
protected static String scanFilePath(Scanner scanner) { if (scanner.hasNext()) { final String token = scanner.next(); if (token.startsWith("\"") || token.startsWith("'")) { final String quote = String.valueOf(token.charAt(0)); if (!token.endsWith(quote)) { final String remainder = scanner.findInLine(".+?" + quote); return token.substring(1) + remainder.substring(0, remainder.length() - 1); } return token.substring(1, token.length() - 1); } return token; } return StringUtils.EMPTY; }
CLIBuilder implements CLIBuilderCallback { protected static String scanFilePath(Scanner scanner) { if (scanner.hasNext()) { final String token = scanner.next(); if (token.startsWith("\"") || token.startsWith("'")) { final String quote = String.valueOf(token.charAt(0)); if (!token.endsWith(quote)) { final String remainder = scanner.findInLine(".+?" + quote); return token.substring(1) + remainder.substring(0, remainder.length() - 1); } return token.substring(1, token.length() - 1); } return token; } return StringUtils.EMPTY; } }
CLIBuilder implements CLIBuilderCallback { protected static String scanFilePath(Scanner scanner) { if (scanner.hasNext()) { final String token = scanner.next(); if (token.startsWith("\"") || token.startsWith("'")) { final String quote = String.valueOf(token.charAt(0)); if (!token.endsWith(quote)) { final String remainder = scanner.findInLine(".+?" + quote); return token.substring(1) + remainder.substring(0, remainder.length() - 1); } return token.substring(1, token.length() - 1); } return token; } return StringUtils.EMPTY; } protected  CLIBuilder(String[] args, String name); }
CLIBuilder implements CLIBuilderCallback { protected static String scanFilePath(Scanner scanner) { if (scanner.hasNext()) { final String token = scanner.next(); if (token.startsWith("\"") || token.startsWith("'")) { final String quote = String.valueOf(token.charAt(0)); if (!token.endsWith(quote)) { final String remainder = scanner.findInLine(".+?" + quote); return token.substring(1) + remainder.substring(0, remainder.length() - 1); } return token.substring(1, token.length() - 1); } return token; } return StringUtils.EMPTY; } protected  CLIBuilder(String[] args, String name); static void printInColor(final String message, final ConsoleColor color, final PrintStream outputStream); void start(); void cmd_help(); void cmd_quit(); void cmd_exit(); void close(); void cmd_debug(); void cmd_modes(); void cmd_mode(Scanner scanner); void setPrintStream(PrintStream printStream); PrintStream getPrintStream(); @Override void printlnIndent(String message); @Override void printlnDots(String message); @Override void println(String message); @Override void println(); void parseAnswer(String command, String answer); void parseLine(String line); }
CLIBuilder implements CLIBuilderCallback { protected static String scanFilePath(Scanner scanner) { if (scanner.hasNext()) { final String token = scanner.next(); if (token.startsWith("\"") || token.startsWith("'")) { final String quote = String.valueOf(token.charAt(0)); if (!token.endsWith(quote)) { final String remainder = scanner.findInLine(".+?" + quote); return token.substring(1) + remainder.substring(0, remainder.length() - 1); } return token.substring(1, token.length() - 1); } return token; } return StringUtils.EMPTY; } protected  CLIBuilder(String[] args, String name); static void printInColor(final String message, final ConsoleColor color, final PrintStream outputStream); void start(); void cmd_help(); void cmd_quit(); void cmd_exit(); void close(); void cmd_debug(); void cmd_modes(); void cmd_mode(Scanner scanner); void setPrintStream(PrintStream printStream); PrintStream getPrintStream(); @Override void printlnIndent(String message); @Override void printlnDots(String message); @Override void println(String message); @Override void println(); void parseAnswer(String command, String answer); void parseLine(String line);  }