code: 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);
      }
docs: 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.
  
  @param stream  an InputStream
  @param regex   the delimiting regular expression
  @param charset opens the stream with a specified charset
  @param closure a closure
  @return the last value returned by the closure
  @throws IOException if an IOException occurs.
  @throws java.util.regex.PatternSyntaxException
  if the regular expression's syntax is invalid
  @see #splitEachLine(java.io.Reader, java.lang.String, groovy.lang.Closure)
  @since 1.5.5