Package: java.lang

## Interface AutoCloseable

- - ### Methods Summary

    Methods
    Return type | Name and parameters
    --- | ---
    `Object` | `withCloseable(Closure action)` Allows this AutoCloseable to be used within the closure, ensuring that it is closed once the closure has been executed and before this method returns.

- - ### Methods Detail

    - #### public Object withCloseable(Closure action)

      Allows this AutoCloseable to be used within the closure, ensuring that it is closed once the closure has been executed and before this method returns.

      As with the try-with-resources statement, if multiple exceptions are thrown the exception from the closure will be returned and the exception from closing will be added as a suppressed exception.

      Parameters:
        `action` - the closure taking the AutoCloseable as parameter
      Returns:
        the value returned by the closure
      Since:
        2.5.0