diff --git a/core/src/com/unciv/ui/screens/savescreens/Gzip.kt b/core/src/com/unciv/ui/screens/savescreens/Gzip.kt index 07b4f46ca2..6f98f51a28 100644 --- a/core/src/com/unciv/ui/screens/savescreens/Gzip.kt +++ b/core/src/com/unciv/ui/screens/savescreens/Gzip.kt @@ -5,17 +5,23 @@ import java.io.BufferedReader import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.io.InputStreamReader +import java.util.zip.Deflater import java.util.zip.GZIPInputStream import java.util.zip.GZIPOutputStream + object Gzip { fun zip(data: String): String = encode(compress(data)) - fun unzip(data: String): String = decompress(decode(data)) + fun unzip(data: String): String = decompress(decode(data)) private fun compress(data: String): ByteArray { val bos = ByteArrayOutputStream(data.length) - val gzip = GZIPOutputStream(bos) + val gzip = object : GZIPOutputStream(bos) { + init { + def.setLevel(Deflater.BEST_COMPRESSION) + } + } gzip.write(data.toByteArray()) gzip.close() val compressed = bos.toByteArray()