public static < T > T withObjectInputStream ( Path self , ClassLoader classLoader , @ ClosureParams ( value = SimpleType . class , options = "java.io.ObjectInputStream" ) Closure < T > closure ) throws IOException { return IOGroovyMethods . withStream ( newObjectInputStream ( self , classLoader ) , closure ) ; }
Create a new ObjectInputStream for this file associated with the given class loader and pass it to the closure . This method ensures the stream is closed after the closure returns .