Package: java.io

## Interface Closeable

- - ### Methods Summary

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

  - #### Methods inherited from interface java.lang.AutoCloseable

    `withCloseable`

- - ### Methods Detail

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

      Allows this closeable 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 Closeable as parameter
      Returns:
        the value returned by the closure
      Since:
        2.4.0