public static < T > T withInputStream ( URL url , @ ClosureParams ( value = SimpleType . class , options = "java.io.InputStream" ) Closure < T > closure ) throws IOException { return IOGroovyMethods . withStream ( newInputStream ( url ) , closure ) ; }
Creates a new InputStream for this URL and passes it into the closure . This method ensures the stream is closed after the closure returns .