Code review request "6402006: FileInputStream.available() returns negative values when reading a large file"
Alan.Bateman at oracle.com
Wed Dec 1 21:39:08 UTC 2010
Mandy Chung wrote:
> Mike, Alan,
> I have updated the fix to use GetFileSizeEx() and SetFilePointerEx().
> Also add a regression test that creates a large sparse file.
> Webrev at:
This looks much better, and the implementation changes looks okay to me .
Thanks for including a test case. A few minor nits:
- at L46, the name "pos" is a bit mis-leading as it's a big skip value
rather than a position.
- it might be cleaner if skipBytes returned the number of bytes skipped
rather then incrementing a static. That way you could initialize
remaining to FILESIZE and then reduce it by the number of bytes skipped.
- it's a bit strange for createLargeFile to arrange for the file to be
deleted on exit, that seems to be something for the caller to arrange.
- At L85, bb.flip would be more correct.
Otherwise looks good to me.
More information about the core-libs-dev