Docs: improve docs for Closeable.use and AutoCloseable.use
This commit is contained in:
@@ -143,13 +143,12 @@ public inline fun URL.readText(charset: Charset = Charsets.UTF_8): String = read
|
||||
*/
|
||||
public fun URL.readBytes(): ByteArray = openStream().use { it.readBytes() }
|
||||
|
||||
// TODO: Provide use kotlin package for AutoCloseable
|
||||
/**
|
||||
* Executes the given [block] function on this resource and then closes it down correctly whether an exception
|
||||
* is thrown or not.
|
||||
*
|
||||
* @param block a function to process this closable resource.
|
||||
* @return the result of [block] function on this closable resource.
|
||||
* @param block a function to process this [Closeable] resource.
|
||||
* @return the result of [block] function invoked on this resource.
|
||||
*/
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <T : Closeable?, R> T.use(block: (T) -> R): R {
|
||||
|
||||
Reference in New Issue
Block a user