use

inline fun <T : AutoCloseable?, R> T.use(block: (T) -> R): R(source)

Execute the given block function on this resource and then close it down correctly whether an exception is thrown or not.

Return

the result of block function invoked on this resource.

Parameters

block

a function to process this AutoCloseable resource.