From 24db41a74e88993d2cae84c972e4050424a4cfe3 Mon Sep 17 00:00:00 2001 From: Graham Date: Thu, 13 Aug 2020 18:25:32 +0100 Subject: [PATCH] Add gzip headers to containers The headerless gzip compression is only used for pack200 files, not containers. Signed-off-by: Graham --- .../java/dev/openrs2/cache/Js5CompressionType.kt | 7 ++++--- .../dev/openrs2/cache/gzip-encrypted.dat | Bin 34 -> 36 bytes .../src/test/resources/dev/openrs2/cache/gzip.dat | Bin 34 -> 36 bytes 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cache/src/main/java/dev/openrs2/cache/Js5CompressionType.kt b/cache/src/main/java/dev/openrs2/cache/Js5CompressionType.kt index 99f3e11d38..83706b56d2 100644 --- a/cache/src/main/java/dev/openrs2/cache/Js5CompressionType.kt +++ b/cache/src/main/java/dev/openrs2/cache/Js5CompressionType.kt @@ -1,11 +1,12 @@ package dev.openrs2.cache import dev.openrs2.compress.bzip2.Bzip2 -import dev.openrs2.compress.gzip.Gzip +import dev.openrs2.compress.gzip.GzipLevelOutputStream import dev.openrs2.compress.lzma.Lzma import java.io.InputStream import java.io.OutputStream import java.util.zip.Deflater +import java.util.zip.GZIPInputStream enum class Js5CompressionType { NONE, @@ -17,7 +18,7 @@ enum class Js5CompressionType { return when (this) { NONE -> input BZIP2 -> Bzip2.createHeaderlessInputStream(input) - GZIP -> Gzip.createHeaderlessInputStream(input) + GZIP -> GZIPInputStream(input) LZMA -> Lzma.createHeaderlessInputStream(input, length.toLong()) } } @@ -26,7 +27,7 @@ enum class Js5CompressionType { return when (this) { NONE -> output BZIP2 -> Bzip2.createHeaderlessOutputStream(output) - GZIP -> Gzip.createHeaderlessOutputStream(output, Deflater.BEST_COMPRESSION) + GZIP -> GzipLevelOutputStream(output, Deflater.BEST_COMPRESSION) /* * LZMA at -9 has significantly higher CPU/memory requirements for * both compression _and_ decompression, so we use the default of diff --git a/cache/src/test/resources/dev/openrs2/cache/gzip-encrypted.dat b/cache/src/test/resources/dev/openrs2/cache/gzip-encrypted.dat index c88e3817f4e334d0f0801f07d67d3fec6d711c10..c186706cb450e9a21da74c667bfb3f6fa78384c4 100644 GIT binary patch literal 36 rcmZQ#U|^6IG+J`!*1Be$W}5(i#UK0ml&iMsT7;P|=Zc@f4wMG~)tw7a literal 34 pcmZQ#U|^8!*{*Ju^pN9ii2uYz#>>C#S3k9*?0Ib>!whzyECARJ4B7wy diff --git a/cache/src/test/resources/dev/openrs2/cache/gzip.dat b/cache/src/test/resources/dev/openrs2/cache/gzip.dat index 8e2ff3cf82f7d3d422f2ed9c7eadb3c69ff7a645..1b021507b5047815eb348153b478ccb9d54309bf 100644 GIT binary patch literal 36 pcmZQ#U|^62Vs`m%4hFl05z$P{pY=V?a&wt6F}&uApTQ240|0BS2IT+% delta 15 UcmY#U;$&iAV2}i2_KDn*00&wDCjbBd