public static <T>T withReader(Reader reader,@ClosureParams(FirstParam.class) Closure<T> closure) throws IOException {
  try {
    T result=closure.call(reader);
    Reader temp=reader;
    reader=null;
    temp.close();
    return result;
  }
  finally {
    closeWithWarning(reader);
  }
}

public static < T > T withReader ( Reader reader , @ ClosureParams ( FirstParam . class ) Closure < T > closure ) throws IOException { try { T result = closure . call ( reader ) ; Reader temp = reader ; reader = null ; temp . close ( ) ; return result ; } finally { closeWithWarning ( reader ) ; } }
allows this reader to be used within the closure , ensuring that it is closed before this method returns .
