You create a temporary file with 'new TemporaryFile()'. This automatically assigns the object a unique filename in the local file system, typically in a system directory reserved for temporary files. The local file can then be opened, read, written, and otherwise manipulated via the File class, just like any other file. Simply pass the TemporaryFile object in place of a filename to the File.openXxx methods.
The underlying file system file will be deleted automatically when the TemporaryFile object is collected by the garbage collector (or when the program terminates). This means that you don't have to worry about cleaning up the file system space used by the file; it'll be released automatically when the file is no longer needed. However, you can call the deleteFile() method to explicitly release the file when you're done with it, if you want to ensure that the resource is returned to the operating system as soon as possible.
TemporaryFile objects are inherently transient - they're only valid for the current session on the current local system, so they can't be saved or restored.
Temporary files are exempt from the file safety level settings, because the inherent restrictions on temporary files provide the same system protections that the safety level settings provide for ordinary files.
TemporaryFile : Object
This method allows you to release the underlying file system resources as soon as you're done with the temp file. It's never necessary to do this. TADS automatically deletes the underlying file system resources when the TemporaryFile object is deleted by the garbage collector (or when the program terminates), so the operating system file will be deleted eventually whether you call this method or not. The point of this method is to let you tell the system *exactly* when you're done with the file, so that the resources can be released earlier than if we waited for garbage collection to take care of it. This should make little difference in most situations, but in a program that will run for a long time and use a lot of temporary files, it might be worthwhile to release resources manually as soon as possible.