java - Practical Use to Temp Files -


what practical use temporary files (see code below)?

file temp = file.createtempfile("temp-file-name", ".tmp"); 

why can't store data keep in file in variables? if file (probably) going deleted on program exit (as "temp" implies), why create them?

an example can such when downloading file, appears temporary file while downloading completes.

aside ram versus disk comment above. may use temp files precusor files or files processed or served. example, server may generate large pdf browser. pdf file stored temp file while (possibly slow) browser downloads file. once communication complete, temp file can destroyed.


Comments

Popular posts from this blog

Line ending issue with Mercurial or Visual Studio -

java - Jtable duplicate Rows -

java - Run a .jar on Heroku -