mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 21:30:20 +07:00
Revert "Set Gzip compression level to Deflater.BEST_COMPRESSION
(#12691)"
This reverts commit 997648e174
.
This commit is contained in:
@ -5,23 +5,17 @@ import java.io.BufferedReader
|
|||||||
import java.io.ByteArrayInputStream
|
import java.io.ByteArrayInputStream
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.InputStreamReader
|
import java.io.InputStreamReader
|
||||||
import java.util.zip.Deflater
|
|
||||||
import java.util.zip.GZIPInputStream
|
import java.util.zip.GZIPInputStream
|
||||||
import java.util.zip.GZIPOutputStream
|
import java.util.zip.GZIPOutputStream
|
||||||
|
|
||||||
|
|
||||||
object Gzip {
|
object Gzip {
|
||||||
|
|
||||||
fun zip(data: String): String = encode(compress(data))
|
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 {
|
private fun compress(data: String): ByteArray {
|
||||||
val bos = ByteArrayOutputStream(data.length)
|
val bos = ByteArrayOutputStream(data.length)
|
||||||
val gzip = object : GZIPOutputStream(bos) {
|
val gzip = GZIPOutputStream(bos)
|
||||||
init {
|
|
||||||
def.setLevel(Deflater.BEST_COMPRESSION)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gzip.write(data.toByteArray())
|
gzip.write(data.toByteArray())
|
||||||
gzip.close()
|
gzip.close()
|
||||||
val compressed = bos.toByteArray()
|
val compressed = bos.toByteArray()
|
||||||
|
Reference in New Issue
Block a user