I guess you could create your own extension functi...
# announcements
m
I guess you could create your own extension function like this:
Copy code
fun <T1: Closeable?, T2: Closeable?, R> Pair<T1, T2>.use(block: (T1, T2) -> R): R =
            first.use { a -> second.use { b -> block(a, b) } }
You could then do
(Buffer() to Okio.source(file)).use { buffer, source -> ... }
.
i
Note that this will leave
Buffer
opened if
Okio.source(file)
throws an exception.