code: public static <T> T withObjectInputStream(Path path, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectInputStream") Closure<T> closure) throws IOException {
          return IOGroovyMethods.withStream(newObjectInputStream(path), closure);
      }
docs: Create a new ObjectInputStream for this file and pass it to the closure.
  This method ensures the stream is closed after the closure returns.
  
  @param path    a Path
  @param closure a closure
  @return the value returned by the closure
  @throws java.io.IOException if an IOException occurs.
  @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure)
  @since 2.3.0