2418N/A * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This class implements a stream filter for reading compressed data in 0N/A * the GZIP file format. 0N/A * @see InflaterInputStream 0N/A * @author David Connelly 0N/A * CRC-32 for uncompressed data. 0N/A * Indicates end of input stream. 0N/A * Check to make sure that this stream has not been closed 0N/A * Creates a new input stream with the specified buffer size. 0N/A * @param in the input stream 0N/A * @param size the input buffer size 2396N/A * @exception ZipException if a GZIP format error has occurred or the 2396N/A * compression method used is unsupported 0N/A * @exception IOException if an I/O error has occurred 0N/A * @exception IllegalArgumentException if size is <= 0 0N/A * Creates a new input stream with a default buffer size. 0N/A * @param in the input stream 2396N/A * @exception ZipException if a GZIP format error has occurred or the 2396N/A * compression method used is unsupported 0N/A * @exception IOException if an I/O error has occurred 0N/A * Reads uncompressed data into an array of bytes. If <code>len</code> is not 0N/A * zero, the method will block until some input can be decompressed; otherwise, 0N/A * no bytes are read and <code>0</code> is returned. 0N/A * @param buf the buffer into which the data is read 0N/A * @param off the start offset in the destination array <code>b</code> 0N/A * @param len the maximum number of bytes read 0N/A * @return the actual number of bytes read, or -1 if the end of the 0N/A * compressed input stream is reached 0N/A * @exception NullPointerException If <code>buf</code> is <code>null</code>. 0N/A * @exception IndexOutOfBoundsException If <code>off</code> is negative, 0N/A * <code>len</code> is negative, or <code>len</code> is greater than 0N/A * <code>buf.length - off</code> 2396N/A * @exception ZipException if the compressed input data is corrupt. 2396N/A * @exception IOException if an I/O error has occurred. 0N/A * Closes this input stream and releases any system resources associated 0N/A * @exception IOException if an I/O error has occurred 0N/A * GZIP header magic number. 0N/A * File header flags. 0N/A private final static int FTEXT =
1;
// Extra text 0N/A private final static int FHCRC =
2;
// Header CRC 0N/A private final static int FEXTRA =
4;
// Extra field 0N/A private final static int FNAME =
8;
// File name 0N/A private final static int FCOMMENT =
16;
// File comment 2409N/A * Reads GZIP member header and returns the total byte number 0N/A // Check header magic 0N/A // Check compression method 0N/A // Skip MTIME, XFL, and OS fields 0N/A // Skip optional extra field 0N/A // Skip optional file name 0N/A // Skip optional file comment 0N/A // Check optional header CRC 2409N/A * Reads GZIP member trailer and returns true if the eos 2409N/A * reached, false if there are more (concatenated gzip 0N/A // Uses left-to-right evaluation order 0N/A // rfc1952; ISIZE is the input size modulo 2^32 2409N/A // If there are more bytes available in "in" or 2409N/A // the leftover in the "inf" is > 26 bytes: 2409N/A // this.trailer(8) + next.header.min(10) + next.trailer(8) 2409N/A return true;
// ignore any malformed, do nothing 0N/A * Reads unsigned integer in Intel byte order. 0N/A * Reads unsigned short in Intel byte order. 0N/A * Reads unsigned byte. 0N/A if (b < -
1 || b >
255) {
0N/A // Report on this.in, not argument in; see read{Header, Trailer}. 0N/A +
".read() returned value out of range -1..255: " + b);
0N/A * Skips bytes of input data blocking until all bytes are skipped. 0N/A * Does not assume that the input stream is capable of seeking.