private List < String > getCommandLines ( File file ) { List < String > lines = new ArrayList <> ( ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { String line = reader . readLine ( ) ; while ( line != null ) { lines . add ( line ) ; line = reader . readLine ( ) ; } } catch ( Throwable e ) { throw new IllegalStateException ( "Failed to process file " + file . getAbsolutePath ( ) , e ) ; } return lines ; }
read the file as a list of text lines