CloseableKt

Added in 1.1.0-beta02

public final class CloseableKt


Summary

Public methods

static final @NonNull R
<T extends Closeable, R extends Object> use(
    @NonNull T receiver,
    @NonNull Function1<@NonNull T, @NonNull R> block
)

Ensures a Closeable object has its close() method called at the end of the supplied block.

Public methods

public static final @NonNull R <T extends Closeable, R extends Object> use(
    @NonNull T receiver,
    @NonNull Function1<@NonNull T, @NonNull R> block
)

Ensures a Closeable object has its close() method called at the end of the supplied block.

Throws
kotlin.Throwable

any exceptions thrown in the block will propagate through this method.