public Settings load(String file, CommandBuilder builder) throws CommandLineException {

		Scanner scanner = null;
		try {

			File config = new File(file);
			Assert.isTrue(config.exists(), "File '" + file + "' does not exist");
			Assert.isFalse(config.isDirectory(), "File '" + file + "' is a directory");
			Assert.isTrue(config.canRead(), "File '" + file + "' cannot be read");

			scanner = new Scanner(config);

			ArrayList<String> list = new ArrayList<>();
			while (scanner.hasNextLine()) {
				list.add(scanner.nextLine());
			}

			return parse(list, builder);
		}
		catch (FileNotFoundException e) {

			log.error("File not found: " + e.getMessage());
			throw new CommandLineException("File: '" + file + "', not found!");
		}
		finally {

			if (scanner != null) {
				scanner.close();
			}
		}
	}
public Settings load ( String file , CommandBuilder builder ) throws CommandLineException { Scanner scanner = null ; try { File config = new File ( file ) ; Assert . isTrue ( config . exists ( ) , "File '" + file + "' does not exist" ) ; Assert . isFalse ( config . isDirectory ( ) , "File '" + file + "' is a directory" ) ; Assert . isTrue ( config . canRead ( ) , "File '" + file + "' cannot be read" ) ; scanner = new Scanner ( config ) ; ArrayList < String > list = new ArrayList < > ( ) ; while ( scanner . hasNextLine ( ) ) { list . add ( scanner . nextLine ( ) ) ; } return parse ( list , builder ) ; } catch ( FileNotFoundException e ) { log . error ( "File not found: " + e . getMessage ( ) ) ; throw new CommandLineException ( "File: '" + file + "', not found!" ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } }
Loads name value pairs directly from given file ... adding them as settings

@param file to get settings from
@return list of settings