Java Reference
In-Depth Information
Supposeyou'redesigningatext-editorapplicationthatauserwillusetoopenatext
fileandmakechangestoitscontent.Untiltheuserexplicitlysavesthesechangestothe
file, you want the text file to remain unchanged.
Becausetheuserdoesn'twanttolosethesechangeswhentheapplicationcrashesor
thecomputerlosespower,youdesigntheapplicationtosavethesechangestoatempor-
ary file every few minutes. This way, the user has a backup of the changes.
Youcanusetheoverloaded
createTempFile()
methodstocreatethetemporary
file.Ifyoudon'tspecifyadirectoryinwhichtostorethisfile,it'screatedinthedirectory
identified by the
java.io.tmpdir
system property.