TempFileCreationStrategy used by TempFile:
Files are collected into one directory and by default are deleted on exit from the VM.
Files may be manually deleted by user prior to JVM exit.
Files can be kept by defining the system property DELETE_FILES_ON_EXIT.
Each file is registered for deletion with the JVM and the temporary directory is not deleted
after the JVM exits. Files that are created in the poifiles directory outside
the control of DefaultTempFileCreationStrategy are not deleted.
See TempFileCreationStrategy for better strategies for long-running
processes or limited temporary storage.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | DELETE_FILES_ON_EXIT
To use files.deleteOnExit after clean JVM exit, set the |
| private volatile File | dir
The directory where the temporary files will be created ( |
| private final Lock | dirLock
The lock to make dir initialized only once. |
| public static final String | POIFILES
Name of POI files directory in temporary directory. |
| Access | Constructor and Description |
|---|---|
| public | DefaultTempFileCreationStrategy()
Creates the strategy so that it creates the temporary files in the default directory. |
| public | DefaultTempFileCreationStrategy(File
The directory where the temporary files will be created ( dir)null to use the default directory).Creates the strategy allowing to set the |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public File | createTempDirectory(String
The directory name to be used to generate the name of the temporary directory. prefix)Implements org. Creates a new and empty temporary directory. |
| public File | createTempFile(String
The prefix to be used to generate the name of the temporary file. prefix, String The suffix to be used to generate the name of the temporary file. suffix)Implements org. Creates a new and empty temporary file. |
| DELETE_FILES_ON_EXIT | back to summary |
|---|---|
| public static final String DELETE_FILES_ON_EXIT To use files.deleteOnExit after clean JVM exit, set the | |
| dir | back to summary |
|---|---|
| private volatile File dir The directory where the temporary files will be created ( | |
| dirLock | back to summary |
|---|---|
| private final Lock dirLock The lock to make dir initialized only once. | |
| POIFILES | back to summary |
|---|---|
| public static final String POIFILES Name of POI files directory in temporary directory. | |
| DefaultTempFileCreationStrategy | back to summary |
|---|---|
| public DefaultTempFileCreationStrategy() Creates the strategy so that it creates the temporary files in the default directory.
| |
| DefaultTempFileCreationStrategy | back to summary |
|---|---|
| public DefaultTempFileCreationStrategy(File dir) Creates the strategy allowing to set the
| |
| createPOIFilesDirectory | back to summary |
|---|---|
| private void createPOIFilesDirectory() throws IOException | |
| createTempDirectory | back to summary |
|---|---|
| public File createTempDirectory(String prefix) throws IOException Implements org. Doc from org. Creates a new and empty temporary directory.
| |
| createTempFile | back to summary |
|---|---|
| public File createTempFile(String prefix, String suffix) throws IOException Implements org. Doc from org. Creates a new and empty temporary file.
| |