diff options
Diffstat (limited to 'java')
| -rw-r--r-- | java/util/zip/GZIPInputStream.java | 10 | ||||
| -rw-r--r-- | java/util/zip/GZIPOutputStream.java | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/java/util/zip/GZIPInputStream.java b/java/util/zip/GZIPInputStream.java index 117cf69d9..1c9793312 100644 --- a/java/util/zip/GZIPInputStream.java +++ b/java/util/zip/GZIPInputStream.java @@ -55,7 +55,7 @@ public class GZIPInputStream /** * The magic number found at the start of a GZIP stream. */ - public static final int GZIP_MAGIC = 0x1f8b; + public static final int GZIP_MAGIC = 0x8b1f; /** * The mask for bit 0 of the flag byte. @@ -198,12 +198,12 @@ public class GZIPInputStream return; } headCRC.update(magic); - if (magic != (GZIP_MAGIC >> 8)) - throw new IOException("Error in GZIP header, first byte doesn't match"); - - magic = in.read(); if (magic != (GZIP_MAGIC & 0xff)) throw new IOException("Error in GZIP header, second byte doesn't match"); + + magic = in.read(); + if (magic != (GZIP_MAGIC >> 8)) + throw new IOException("Error in GZIP header, first byte doesn't match"); headCRC.update(magic); /* 2. Check the compression type (must be 8) */ diff --git a/java/util/zip/GZIPOutputStream.java b/java/util/zip/GZIPOutputStream.java index ff66e5fe2..ea9ec9d08 100644 --- a/java/util/zip/GZIPOutputStream.java +++ b/java/util/zip/GZIPOutputStream.java @@ -86,8 +86,8 @@ public class GZIPOutputStream extends DeflaterOutputStream byte[] gzipHeader = { /* The two magic bytes */ - (byte) (GZIPInputStream.GZIP_MAGIC >> 8), (byte) GZIPInputStream.GZIP_MAGIC, + (byte) (GZIPInputStream.GZIP_MAGIC >> 8), /* The compression type */ (byte) Deflater.DEFLATED, |
