public static <T> T withReader(Reader reader, @ClosureParams(value=SimpleType.class, options="java.io.Reader") 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 ( value = SimpleType . class , options = "java.io.Reader" ) 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.

@param reader  the reader which is used and then closed
@param closure the closure that the writer is passed into
@return the value returned by the closure
@throws IOException if an IOException occurs.
@since 1.5.2