package com.example.base.extensions

import java.io.Closeable
import java.io.IOException

/**
 * 安全关闭
 */
fun Closeable.safeClose() {
    try {
        this.close()
    } catch (e: IOException) {
        e.printStackTrace()
    }
}

fun Closeable.closeQuietly() {
    try {
        this.close()
    } catch (rethrown: RuntimeException) {
        throw rethrown
    } catch (ignored: Exception) {
    }

}