I believe this is more a OS issue than a Java specific issue. What I would do in the situation is build the new file and move it to replace the previous version. If nothing else, the time where the state of the file is in flux would be much smaller. The downside, is that for a few moments you would have 2 copies of your file until the move takes place.
// create a temporary file
File f = new File("/files/huge_file.bck");
// your method to write to the file...
populateHugeFile(f);
if(!f.renameTo(new File("/files/huge_file.txt")) {
// renaming failed; try again?
}
Even this has risks however. From the API:
Many aspects of the behavior of this method are inherently platform-dependent: The rename operation might not be able to move a file from one filesystem to another, it might not be atomic, and it might not succeed if a file with the destination abstract pathname already exists.