/[classpath]/classpath/java/util/zip/GZIPInputStream.java
ViewVC logotype

Diff of /classpath/java/util/zip/GZIPInputStream.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by mkoch, Mon Apr 12 12:30:57 2004 UTC revision 1.8.2.1 by gnu_andrew, Sat Jan 15 17:02:16 2005 UTC
# Line 35  this exception to your version of the li Line 35  this exception to your version of the li
35  obligated to do so.  If you do not wish to do so, delete this  obligated to do so.  If you do not wish to do so, delete this
36  exception statement from your version. */  exception statement from your version. */
37    
38    
39  package java.util.zip;  package java.util.zip;
40    
 import java.io.InputStream;  
 import java.io.IOException;  
41  import java.io.EOFException;  import java.io.EOFException;
42    import java.io.IOException;
43    import java.io.InputStream;
44    
45  /**  /**
46   * This filter stream is used to decompress a "GZIP" format stream.   * This filter stream is used to decompress a "GZIP" format stream.
# Line 55  public class GZIPInputStream Line 56  public class GZIPInputStream
56    /**    /**
57     * The magic number found at the start of a GZIP stream.     * The magic number found at the start of a GZIP stream.
58     */     */
59    public static final int GZIP_MAGIC = 0x1f8b;    public static final int GZIP_MAGIC = 0x8b1f;
60    
61    /**    /**
62     * The mask for bit 0 of the flag byte.     * The mask for bit 0 of the flag byte.
# Line 197  public class GZIPInputStream Line 198  public class GZIPInputStream
198        eos = true;        eos = true;
199        return;        return;
200      }      }
201        int magic2 = in.read();
202        if ((magic + (magic2 << 8)) != GZIP_MAGIC)
203          throw new IOException("Error in GZIP header, bad magic code");
204      headCRC.update(magic);      headCRC.update(magic);
205      if (magic != (GZIP_MAGIC >> 8))      headCRC.update(magic2);
       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");  
     headCRC.update(magic);  
206            
207      /* 2. Check the compression type (must be 8) */      /* 2. Check the compression type (must be 8) */
208      int CM = in.read();      int CM = in.read();

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.8.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26