Colton Idle
08/07/2024, 4:48 PMFilipp Zhinkin
08/12/2024, 9:56 PMFilipp Zhinkin
08/12/2024, 9:56 PMFilipp Zhinkin
08/12/2024, 9:56 PMGary Peck
08/17/2024, 9:35 AMJavier
10/09/2024, 9:24 PMkotlinx-io
is there any easy way to read a file from the resources
directory?alexandre mommers
10/11/2024, 1:20 PMMorten Minke
11/25/2024, 7:39 PMreadInto
method which is a suspend method (which makes sense with io operations). I want convert this FileKit specific PlatformInputStream into a generic kotlinx.io (Raw)Source to further use in my application. However, the kotlinx.io RawSource has a method, override fun readAtMostTo
, which I need to implement for this, but this method is not a suspend function.
Because this is a MPP and both FileKit and kotlinx.io are also MPP I think I should be able to make this work in common code, but I fail because the readInto method is not a suspend function but I need a coroutine context to call the readAtMostTo and wait for the result to return. In jvm I would be able to use runBlocking to call and wait for the result, but this is not possible in MPP common code. I really thought about different solutions but I cannot find a good solution for this. Does anybody have an idea?
For simplicity here is some pseudo code showing what I try to achieve:
class PlatformInputStreamSource(
private val platformInputStream: PlatformInputStream
) : RawSource {
override fun readAtMostTo(sink: Buffer, byteCount: Long): Long {
...
<< Here i need to start a coroutine context and wait for the numberOfBytesCopied
val numberOfBytesCopied = platformInputStream.readInto(buffer, byteCount, bufferSize))
...
<< This non suspend function needs to return the number of bytes copied and therefor has to wait for the result from the readInto function.
return numberOfBytesCopied.toLong()
}
}
suresh
11/25/2024, 9:49 PMhfhbd
11/26/2024, 8:59 PMmyRawSource.buffered().buffered().buffered()
creates a new RealSource each time? Shouldn't be there an extension on Source.buffered() = this
?hfhbd
12/04/2024, 12:49 PMChris Lee
12/05/2024, 7:15 PMedenman
12/06/2024, 7:02 PMMark
12/09/2024, 5:37 AMTóth István Zoltán
12/26/2024, 6:10 AMfun Path.copy(target: Path, override: Boolean = false) {
check(target.exists() && ! override) { "file $target already exists" }
SystemFileSystem.sink(target, append = false).buffered().use { sink ->
SystemFileSystem.source(this).buffered().use { source ->
source.transferTo(sink)
}
}
}
Rob Elliot
03/14/2025, 10:13 AMkotlinx.io.asSource
returns a RawSource
, which is not a Source
.
Have you considered renaming it to kotlinx.io.asRawSource
, and making kotlinx.io.asSource
syntactic sugar for .asRawSource().buffered()
?Tóth István Zoltán
03/20/2025, 5:55 AMatomicMove
in <http://kotlinx.io|kotlinx.io>
does not support overwriting existing files. Any advices how to achieve this?
The problem with delete
+ atomicMove
is that there exists a moment where the original file is deleted but the move did not happen yet.edenman
04/03/2025, 3:51 PMSource
is all syncRTAkland
04/05/2025, 10:57 AMhfhbd
04/09/2025, 10:25 AMrawSource.readAtMostTo()
, but this api requires a Buffer
, not a RawSink
that can be ignored by an discardingSink
. (I can use discardingSink().buffered().buffer
though, but it is an internal api.)RTAkland
04/18/2025, 7:00 AMkevin.cianfarini
04/25/2025, 8:04 PMdummy: Any?
parameter which is always null? https://github.com/Kotlin/kotlinx-io/blob/master/bytestring/common/src/ByteString.kt#L81hfhbd
05/08/2025, 6:41 AMursus
05/23/2025, 3:06 PMFileSystem
being experimental
mean in practise say for ios build? Is it runtime safe for prod? or is it more of api stability issueZyle Moore
06/08/2025, 9:43 PMBuffer
? (200MB+)Matt Nelson
06/11/2025, 10:37 PM0.3.0
is out with support for Android Native, including a proper system temp directory for Android API 31 and below 🎉joseph_ivie
08/06/2025, 8:45 PMTóth István Zoltán
08/07/2025, 8:58 AMTóth István Zoltán
08/07/2025, 9:15 AMjoseph_ivie
08/14/2025, 11:01 PM