in `FileHandle` okio, when I use `source().buffer(...
# io
e
in
FileHandle
okio, when I use
source().buffer()
shall I close (
use
) only the latter or also the first one?
m
The BufferedSource closes its underlying Source so it's ok to do
Copy code
source.buffer().use {}
👍 1
It'd be nice to add this to the KDocs somewhere, I had the same question
e
next short PR? 😄
m
Maybe here?
e
maybe
m
Another question is whether it's ok to buffer twice the same source. I'm guessing not
e
and/or where it was specified to close the resource
I recall I read that closing twice isn't correct, but won't throw
m
So many questions 😅
😂 2
e
when I use
source().buffer()
Generally speaking I'd say the concept is the same as buffered resources in Java, just close the buffered one, which internally will take care of the wrapped one.
1