Created
November 14, 2016 03:20
-
-
Save stepango/fcded7beac2e1979cf57013c65a9f557 to your computer and use it in GitHub Desktop.
Copy data from FileDescriptor to File in Kotlin, using okio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun copy(fd: FileDescriptor, file: File) { | |
Okio.source(FileInputStream(fd)).use { source -> | |
Okio.buffer(Okio.sink(file)).use { buffer -> buffer.writeAll(source) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment