public static < T > T splitEachLine ( InputStream stream , String regex , String charset , @ ClosureParams ( value = FromString . class , options = "List<String>" ) Closure < T > closure ) throws IOException { return splitEachLine ( new BufferedReader ( new InputStreamReader ( stream , charset ) ) , regex , closure ) ; }
Iterates through the given InputStream line by line using the specified encoding splitting each line using the given separator . The list of tokens for each line is then passed to the given closure . Finally the stream is closed .