java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.i2p.util.ResettableGZIPInputStream.ExtraByteInputStream
All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing class:
ResettableGZIPInputStream

private static class ResettableGZIPInputStream.ExtraByteInputStreamextends FilterInputStream
Essentially a SequenceInputStream(in, new ByteArrayInputStream(new byte[1])), except that this is resettable.

Unsupported: - available() doesn't include the extra byte - skip() doesn't skip the extra byte

Why? otherwise the inflater finished() is wrong when the compressed payload (in between the 10 byte header and the 8 byte footer) is a multiple of 512 bytes, which caused read(buf, off, len) above to fail. Happened every time with 1042 byte compressed router infos, for example.

Details:

Warning with Inflater nowrap = true:

"Note: When using the 'nowrap' option it is also necessary to provide an extra "dummy" byte as input. This is required by the ZLIB native library in order to support certain optimizations."

Inflater

This is for sure:

"This is not nearly specific enough to be useful. Where in the compressed byte array is the extra 'dummy' byte" expected? What is it to contain? When calling setInput() is the 'len' argument incremented to include the dummy byte or not?"

This is useless:

java-forums thread

This seems to be the definitive answer:

"The fix simply involves copying the byte array and tacking a single null byte on to the end."

http://code.google.com/p/google-apps-sso-sample/issues/detail?id=8