code: public static <T> T splitEachLine(Reader self, Pattern pattern, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
          BufferedReader br;
          T result = null;
  
          if (self instanceof BufferedReader)
              br = (BufferedReader) self;
          else
              br = new BufferedReader(self);
  
          try {
              while (true) {
                  String line = br.readLine();
                  if (line == null) {
                      break;
                  } else {
                      List vals = Arrays.asList(pattern.split(line));
                      result = closure.call(vals);
                  }
              }
              Reader temp = self;
              self = null;
              temp.close();
              return result;
          } finally {
              closeWithWarning(self);
              closeWithWarning(br);
          }
      }
docs: Iterates through the given reader line by line, splitting each line using
  the given regex separator Pattern. For each line, the given closure is called with
  a single parameter being the list of strings computed by splitting the line
  around matches of the given regular expression.  The Reader is closed afterwards.
  <p>
  Here is an example:
  <pre>
  def s = 'The 3 quick\nbrown 4 fox'
  def result = ''
  new StringReader(s).splitEachLine(~/\d/){ parts ->
  result += "${parts[0]}_${parts[1]}|"
  }
  assert result == 'The _ quick|brown _ fox|'
  </pre>
  
  @param self    a Reader, closed after the method returns
  @param pattern the regular expression Pattern for the delimiter
  @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 java.lang.String#split(java.lang.String)
  @since 1.6.8