square / okio

A modern I/O library for Android, Java, and Kotlin Multiplatform.
https://square.github.io/okio/
Apache License 2.0
8.72k stars 1.17k forks source link

BufferedSink.writeUtf8() not writing all content to file #1480

Closed chungchungdev closed 1 month ago

chungchungdev commented 1 month ago

My little project extract strings from some tbl files and then write them to a txt file. But the BufferedSink.writeUtf8() method cannot write all content to the file. I also tested with printing to console and java nio,. Only okio produce inconsistent result, the last few lines are missing.

The raw file is probably copyrighted so I share it separately on a google drive link. Put it "src/main/kotlin/ggendata" folder, then run the Main.kt.

JakeWharton commented 1 month ago

Are you wrapping it in a use so that the buffer is flushed and the file is closed?

chungchungdev commented 1 month ago

well... you are right. I am really sorry for wasting you guys time...

JakeWharton commented 1 month ago

No problem! Glad you got it sorted out.