https://kotlinlang.org logo
Title
m

matt tighe

08/30/2018, 4:55 PM
can anyone tell me if
File.writeBytes()
is async?
k

karelpeeters

08/30/2018, 4:58 PM
Depends on what you mean by async here.
h

Hele

08/30/2018, 5:01 PM
When I check here I don't see that it is
but you can go further and check if the write method itself is async or not
k

karelpeeters

08/30/2018, 5:02 PM
It's a native method.
h

Hele

08/30/2018, 5:03 PM
From async, I believe he means if the code is processed on main thread or background thread
k

karelpeeters

08/30/2018, 5:04 PM
Well there's probably buffering by the OS at least. But why does that matter?
h

Hele

08/30/2018, 5:07 PM
Isn't he asking for that ?
What else async mean ?
m

matt tighe

08/30/2018, 5:09 PM
i change permissions of the newly created file immediately after, so i’m worried it won’t be finished flushing the buffer
k

karelpeeters

08/30/2018, 5:10 PM
You don't need to worry about that, all of that is handled at a way lower level.
There should be no observable differences.
👍 1
m

matt tighe

08/30/2018, 5:10 PM
thanks