kenkyee
11/14/2023, 7:12 PMjw
11/14/2023, 7:17 PMkenkyee
11/14/2023, 7:49 PMJoshua Hansen
11/14/2023, 10:12 PMPath(
System.getProperty("user.home"),
"Desktop",
"filename.json",
).outputStream().use {
Json.encodeToStream(mySerializableClass, it)
}
Im using 1.6
Might be worth seeing if using use
and letting the stream close itself helps?jw
11/14/2023, 10:21 PMJoshua Hansen
11/14/2023, 10:33 PMkenkyee
11/14/2023, 11:22 PM1.4 is where the abstraction between JVM streams and Okio streams was added. It's possible it had bugs. Is there a reason you're on a such an old version rather than going to 1.6?Good to know that some major change did go in with 1.4. Yep, only noticed because someone bumped our kotlinx.serialization libs to the latest 1.6 and broke this bit of code and I had to backtrack a bit to find it. I should have mentioned the current and original code used writer.use {} to let it autoclose as well. I tried adding a flush in that but it made no difference. Will try to create a repro since this would be ugly for other folks to hit...