hfhbd
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.)Filipp Zhinkin
04/09/2025, 4:48 PM.buffered()
) and then use a peek source for every read. Something like:
SystemFileSystem.source(...).buffered().use { src ->
val startOffset = src.peek().buffered().use { p ->
p.skip(fileSize - 8)
p.readLong() // or int?
}
src.peek().buffered().use { p ->
p.skip(startOffset)
p.readMetadataHeader()
}
}
(I can useIt's the same as creating athough, but it is an internal api.)discardingSink().buffered().buffer
Buffer
manually and then writing into it: there's no hidden connection between the discarding sink and a buffer, so nothing will be discarded.hfhbd
04/10/2025, 12:11 PMbuffer()
is cheap? I thought it will load the whole file in memory (not once, but each segment over and over).Filipp Zhinkin
04/14/2025, 2:25 PMIf a file is small enough to fit into a memory
kodee sadkevin.cianfarini
04/24/2025, 2:59 PMFilipp Zhinkin
04/24/2025, 3:03 PMkevin.cianfarini
04/24/2025, 3:06 PM