public static <T> T withPrintWriter(Writer writer, @ClosureParams(value=SimpleType.class, options="java.io.PrintWriter") Closure<T> closure) throws IOException {
        return withWriter(newPrintWriter(writer), closure);
    }
public static < T > T withPrintWriter ( Writer writer , @ ClosureParams ( value = SimpleType . class , options = "java.io.PrintWriter" ) Closure < T > closure ) throws IOException { return withWriter ( newPrintWriter ( writer ) , closure ) ; }
Create a new PrintWriter for this Writer.  The writer is passed to the
closure, and will be closed before this method returns.

@param writer  a writer
@param closure the closure to invoke with the PrintWriter
@return the value returned by the closure
@throws IOException if an IOException occurs.
@since 1.6.0