question: private Collection < String > readProcessOutput ( Process proc ) throws IOException { BufferedReader rdr = new BufferedReader ( new InputStreamReader ( proc . getInputStream ( ) ) ) ; Collection < String > res = new ArrayList < > ( ) ; String s ; while ( ( s = rdr . readLine ( ) ) != null ) res . add ( s ) ; return res ; }
target:  Reads process output line-by-line.