Shrink input buffer in inflate-stream

The patch shrinks the input buffer of inflate stream, so that minimum data would kept within the decoder.

The issue is not trivial but has real-world impact; I have seen crashes due to the problem described in http://blog.kazuhooku.com/2013/11/do-not-allocate-typed-arrays-too.html which is mitigated by the patch.

EDIT: Sorry, I am not sure if the patch is trying to change the API exposed by the decoder.