Code review request "6631046: BufferedInputStream.available() reports negative int on very large inputstream"

Mike Duigou mike.duigou at oracle.com
Fri Nov 19 00:42:25 UTC 2010


Looks good to me.

Mike

On Nov 18 2010, at 14:34 , Mandy Chung wrote:

> 6631046: BufferedInputStream.available() reports negative int on very large inputstream
> 
> Webrev at:
> http://cr.openjdk.java.net/~mchung/6631046/webrev.00/
> 
> InputStream.available() returns an int. For streams larger than 2GB, the FileInputStream.available() implementation returns Integer.MAX_VALUE which is a reasonable choice.
> 
> java.io.BufferedInputStream and java.io.PushbackInputStream maintain a buffer.  The available() method in these 2 classes returns the sum of the number of bytes remaining to be read in the buffer and the result of calling the in.available().   If in.available() returns a large number, the result may overflow and a negative size will be returned.  This fixes to handle the overflow case properly.
> 
> Thanks
> Mandy




More information about the core-libs-dev mailing list