CompositeAutoClosable

Constructors

Link copied to clipboard
fun CompositeAutoClosable(vararg autoCloseables: AutoCloseable)

Functions

Link copied to clipboard
fun <T : AutoCloseable> add(autoCloseable: T): T

Adds a AutoCloseable that will be called when the CompositeAutoClosable's close is called.

inline fun add(crossinline autoCloseable: () -> Unit): AutoCloseable

Adds lambda type AutoCloseable that will be called when the CompositeAutoClosable's close is called.

Link copied to clipboard
open override fun close()

Invokes AutoCloseable.close on all AutoCloseables in reverse order and removes them from this container.

Link copied to clipboard

Returns true if this composite has no autoCloseables added, otherwise false.