Closed Gieted closed 1 year ago
Never mind, you just need to set nowrap
parameter to true, and then it works:
fun deflate(input: ByteArray): ByteArray {
val outputStream = ByteArrayOutputStream()
DeflaterOutputStream(outputStream, Deflater(Deflater.BEST_COMPRESSION, true)).use {
it.write(input)
it.finish()
}
return outputStream.toByteArray()
}
It looks like data compressed using Java's built-in Deflater cannot be uncompressed using archive's
Inflate
.In JVM/Kotlin:
Then in Dart:
This seems weird as both are supposed to use the same "deflate" algorithm.