Michal Klimczak
04/03/2021, 4:57 PMktor
ByteReadChannel
to ios NSOutputStream
(I think) and I don't have an idea how to mix these apis.
I'm also gonna need to then unzip it and move the files and dirs from the zip package to the local storage, but this is probably not really feasible in common code before okio files api, right?
kotlinx-io seems to be dead.Shakil Karim
04/03/2021, 5:16 PMMichal Klimczak
04/03/2021, 5:23 PMjw
04/03/2021, 6:25 PMShakil Karim
04/03/2021, 6:51 PMMichal Klimczak
04/03/2021, 6:52 PMjw
04/03/2021, 7:45 PMMichal Klimczak
04/03/2021, 8:00 PMUnable to build Kotlin project configuration
org.gradle.internal.resolve.ArtifactNotFoundException: Could not find okio-3.0.0-alpha.1-samplessources.jar (com.squareup.okio:okio:3.0.0-alpha.1).
Searched in the following locations:
<https://jcenter.bintray.com/com/squareup/okio/okio/3.0.0-alpha.1/okio-3.0.0-alpha.1-samplessources.jar>
at ...
I don't really know why it tries to load it from jcenter, I even removed it entirely from respositories
commonMain -> implementation("com.squareup.okio:okio:3.0.0-alpha.2")
Okay, same for alpha.1 and 2.10.0...implementation("com.squareup.okio:okio-multiplatform:3.0.0-alpha.2")
Shakil Karim
04/04/2021, 7:31 AMMichal Klimczak
04/04/2021, 7:42 AMTrying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread
...nor pass it from one thread to another (frozen mutation etc).
I kinda managed to do that with something like (writing pseudocode from memory):
withContext(Dispatchers.Main){
FileSystem.SYSTEM.write(path){
httpClient.get<HttpStatement>...{
write(buffer)
}
}
}
And it created the file and allocated bytes, but something froze and I'm not even sure what is done on what thread here.
@jw is it supposed to work on background thread in kotlin native? If so, how can I create the BufferedSink from FileSystem and then do the writing on bg thread? Something like Okio.buffer(FileSystem.SYSTEM.sink(path))
only seems to be doable on main thread.