File#createTempFile, this task does not (by default) actually create the
temporary file, but it does guarantee that the file did not
exist when the task was executed.
Examples
<tempfile property="temp.file" />create a temporary file
<tempfile property="temp.file" suffix=".xml" />create a temporary file with the .xml suffix.
<tempfile property="temp.file" destDir="build"/>create a temp file in the build subdir
| Modifier and Type | Field and Description |
|---|---|
| private boolean | createFile
createFile flag |
| private boolean | deleteOnExit
deleteOnExit flag |
| private File | destDir
Directory to create the file in. Can be null. |
| private static final FileUtils | |
| private String | prefix
Prefix for the file. |
| private String | property
Name of property to set. |
| private String | suffix
Suffix for the file. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public boolean | Returns: the createFile flag.Learn whether createFile flag is set for this tempfile task. |
| public boolean | Returns: boolean deleteOnExit flag.Learn whether deleteOnExit is set for this tempfile task. |
| public void | setCreateFile(boolean
boolean flag. createFile)If set the file is actually created, if not just a name is created. |
| public void | setDeleteOnExit(boolean
boolean flag. deleteOnExit)Set whether the tempfile created by this task should be set for deletion on normal VM exit. |
| public void | |
| public void | |
| public void | setProperty(String
The property to set property)Sets the property you wish to assign the temporary file to. |
| public void |
| createFile | back to summary |
|---|---|
| private boolean createFile createFile flag | |
| deleteOnExit | back to summary |
|---|---|
| private boolean deleteOnExit deleteOnExit flag | |
| destDir | back to summary |
|---|---|
| private File destDir Directory to create the file in. Can be null. | |
| FILE_UTILS | back to summary |
|---|---|
| private static final FileUtils FILE_UTILS | |
| prefix | back to summary |
|---|---|
| private String prefix Prefix for the file. | |
| property | back to summary |
|---|---|
| private String property Name of property to set. | |
| suffix | back to summary |
|---|---|
| private String suffix Suffix for the file. | |
| TempFile | back to summary |
|---|---|
| public TempFile() | |
| execute | back to summary |
|---|---|
| public void execute() throws BuildException Overrides org. Creates the temporary file.
| |
| isCreateFile | back to summary |
|---|---|
| public boolean isCreateFile() Learn whether createFile flag is set for this tempfile task.
| |
| isDeleteOnExit | back to summary |
|---|---|
| public boolean isDeleteOnExit() Learn whether deleteOnExit is set for this tempfile task.
| |
| setCreateFile | back to summary |
|---|---|
| public void setCreateFile(boolean createFile) If set the file is actually created, if not just a name is created.
| |
| setDeleteOnExit | back to summary |
|---|---|
| public void setDeleteOnExit(boolean deleteOnExit) Set whether the tempfile created by this task should be set for deletion on normal VM exit.
| |
| setDestDir | back to summary |
|---|---|
| public void setDestDir(File destDir) Sets the destination directory. If not set, the basedir directory is used instead.
| |
| setPrefix | back to summary |
|---|---|
| public void setPrefix(String prefix) Sets the optional prefix string for the temp file.
| |
| setProperty | back to summary |
|---|---|
| public void setProperty(String property) Sets the property you wish to assign the temporary file to.
| |
| setSuffix | back to summary |
|---|---|
| public void setSuffix(String suffix) Sets the optional suffix string for the temp file.
| |