public class LargeFileGZIPInputStream extends GZIPInputStream
Java currently has a bug that does not allow unzipping Gzip files with contents larger than 2GB. The result will be an IOException with the message "Corrupt GZIP trailer". This class works around that bug by ignoring that message for all streams which are uncompressed larger than 2GB. This sacrifices CRC checks for those streams, though.
See sun bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5092263
GZIPInputStream
crc, eos, GZIP_MAGIC
buf, inf, len
in
Constructor and Description |
---|
LargeFileGZIPInputStream(InputStream in)
Creates a new input stream with a default buffer size.
|
Modifier and Type | Method and Description |
---|---|
int |
read(byte[] buf,
int off,
int len)
Reads uncompressed data into an array of bytes.
|
close
available, fill, mark, markSupported, read, reset, skip
read
public LargeFileGZIPInputStream(InputStream in) throws IOException
in
- the input streamIOException
- if an I/O error has occurred. Note: We usually don't allow IOException in our code, but this
is done here to closely mimic GZIPInputStreampublic int read(byte[] buf, int off, int len) throws IOException
read
in class GZIPInputStream
buf
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes readIOException
- if an I/O error has occurred or the compressed input data is corrupt. Note that size
differences are ignored in this workaround class if size is larger than Integer.MAX_VALUE. Note: We usually don't
allow IOException in our code, but this is done here to closely mimic GZIPInputStreamCopyright © 2005–2018 The Royal Danish Library, the National Library of France and the Austrian National Library.. All rights reserved.