close

expect abstract fun close()(source)

Closes this resource.

This function may throw, thus it is strongly recommended to use the use function instead, which closes this resource correctly whether an exception is thrown or not.

Implementers of this interface should pay increased attention to cases where the close operation may fail. It is recommended that all underlying resources are closed and the resource internally is marked as closed before throwing an exception. Such a strategy ensures that the resources are released in a timely manner, and avoids many problems that could come up when the resource wraps, or is wrapped, by another resource.

Note that calling this function more than once may have some visible side effect. However, implementers of this interface are strongly recommended to make this function idempotent.

Since Kotlin

1.8
actual abstract fun close()(source)

Since Kotlin

1.8
actual abstract fun close()(source)

Since Kotlin

1.8