alakazam.kotlin.core.CloseableExtensions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-core Show documentation
Show all versions of kotlin-core Show documentation
A set of useful functions and extensions for Kotlin development.
package alakazam.kotlin.core
import java.io.Closeable
/**
* Attempts to call [Closeable.close], ignoring any exceptions which might be thrown. Will still
* allow through other [Throwable]s (e.g. [NoClassDefFoundError])
*/
public fun Closeable.quietlyClose() {
try {
close()
} catch (e: Exception) {
// No-op
}
}