RFR 8204310 : Simpler RandomAccessFile.setLength() on Windows

Ivan Gerasimov ivan.gerasimov at oracle.com
Tue Jun 5 06:23:00 UTC 2018


Hello!

When a file size is modified via RandomAccessFile.setLength(int) on 
Windows, it is currently done in three steps:

SetFilePointer(), SetEndOfFile(), SetFilePointerEx().

First two can be combined in one call of SetFileInformationByHandle(), 
which will make the code shorter and more aligned with Unix variant 
(ftruncate64 is used on Unix systems, which behaves close to 
SetFileInformationByHandle(_,FileEndOfFileInfo,_)).

Would you please help review this trivial fix?

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8204310
WEBREV: http://cr.openjdk.java.net/~igerasim/8204310/00/webrev/

All the existing tests pass Ok.

-- 
With kind regards,
Ivan Gerasimov



More information about the core-libs-dev mailing list