class CommandUtility {

    public static List<String> getCommandsFromFile(String fileName, String... params) {
        List<String> commands = new ArrayList<>();

        try (Stream<String> stream = Files.lines(Paths.get(ClassLoader.getSystemResource(fileName).toURI()))) {

            // stream to ignore comments and empty lines
            // replace parameters using MessageFormat
            commands = stream
                    .filter(line -> !line.startsWith("#") && (!line.isEmpty()))
                    .map(line-> MessageFormat.format(line, params))
                    .collect(Collectors.toList());

        } catch (URISyntaxException e) {
            e.printStackTrace();
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }

        return commands;
    }

}