Docs: improve docs for Closeable.use and AutoCloseable.use

This commit is contained in:
Ilya Gorbunov
2016-07-13 19:38:37 +03:00
parent b09fc7c146
commit e9ccc480b0
2 changed files with 12 additions and 3 deletions
+2 -3
View File
@@ -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 {