Use JagexGzipOutputStream to compress gzipped JS5 containers

The output is bit-for-bit identical to Jagex's implementation.

Signed-off-by: Graham <gpe@openrs2.org>
Graham 3 years ago
parent 64b1e2e5b9
commit 26d5d5fd6e
  1. 5
      cache/src/main/kotlin/org/openrs2/cache/Js5CompressionType.kt

@ -1,11 +1,10 @@
package org.openrs2.cache package org.openrs2.cache
import org.openrs2.compress.bzip2.Bzip2 import org.openrs2.compress.bzip2.Bzip2
import org.openrs2.compress.gzip.GzipLevelOutputStream import org.openrs2.compress.gzip.JagexGzipOutputStream
import org.openrs2.compress.lzma.Lzma import org.openrs2.compress.lzma.Lzma
import java.io.InputStream import java.io.InputStream
import java.io.OutputStream import java.io.OutputStream
import java.util.zip.Deflater
import java.util.zip.GZIPInputStream import java.util.zip.GZIPInputStream
public enum class Js5CompressionType { public enum class Js5CompressionType {
@ -27,7 +26,7 @@ public enum class Js5CompressionType {
return when (this) { return when (this) {
UNCOMPRESSED -> output UNCOMPRESSED -> output
BZIP2 -> Bzip2.createHeaderlessOutputStream(output) BZIP2 -> Bzip2.createHeaderlessOutputStream(output)
GZIP -> GzipLevelOutputStream(output, Deflater.BEST_COMPRESSION) GZIP -> JagexGzipOutputStream(output)
/* /*
* LZMA at -9 has significantly higher CPU/memory requirements for * LZMA at -9 has significantly higher CPU/memory requirements for
* both compression _and_ decompression, so we use the default of * both compression _and_ decompression, so we use the default of

Loading…
Cancel
Save