code: public static <T> T withObjectOutputStream(OutputStream outputStream, @ClosureParams(value=SimpleType.class, options="java.io.ObjectOutputStream") Closure<T> closure) throws IOException {
          return withStream(newObjectOutputStream(outputStream), closure);
      }
docs: Create a new ObjectOutputStream for this output stream and then pass it to the
  closure.  This method ensures the stream is closed after the closure
  returns.
  
  @param outputStream am output stream
  @param closure      a closure
  @return the value returned by the closure
  @throws IOException if an IOException occurs.
  @see #withStream(java.io.OutputStream, groovy.lang.Closure)
  @since 1.5.0