I reckon the root problem is the difference between the semantics of the
InputStream and
InflaterInputStream available() methods.
Input stream.available() returns the number of bytes left before blocking, while InflaterInputStream returns 1 if the end of stream has not yet been reached,
even if there are no more bytes to be had.When I ran into this I was deserialising an object graph that includes Other People's Code (read: probably broken), so I thought I'd do a check with available() and see if there were bytes left over after deserialisation was apparently complete - which would indicate that somewhere bytes were being written but not read. This worked fine with normal streams, but would throw occasional errors with GZIP streams thanks to this difference.
At any rate, it all works now and serialisation sanity is being more thoroughly checked elsewhere.
Cheers all!