API to create a temp file for the duration of task execution

Al Le <[email protected]>
Newsgroups gmane.comp.jakarta.ant.user
Message-ID <[email protected]>
Hello,

I'd like to implement a custom task. Its implementation would perform 
following things:

1. Create a file (in .properties format)

2. Do some magic (the main logic of the task) which uses the file 
created in step 1.

3. Delete the file created in step 1.

You see that the file from the step 1 is just a temporary one and should 
not remain after the task is completed.



I have some questions:

1. Is there an Ant API to create a temp file? Or should I just use the 
standard Java API for this?

2. How would I ensure that the file is deleted after the task completes? 
Is there some mechanisms for this is Ant? Or should I just carefully 
program try-catch-finally and delete the file in the finally block (or 
use try with resources)?

Thank you for any hints.

AL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.