I\'m trying to create a zip file in Kotlin. this is the code:
fun main(args: Array) {
var files: Array = arrayOf(\"/home/matte/th
If you use Kotlin's IOStreams.copyTo()
extension, it will do the copying work for you, and that ended up working for me.
So replace this:
origin.buffered(1024).reader().forEachLine {
out.write(data)
}
With this:
origin.copyTo(out, 1024)
I also had issues with the ZipEntry
having a leading slash, but that could just be because I'm on Windows.
Note: I didn't end up needing to call closeEntry()
to get this to work but it is recommended.