org.apache.poi.util
Class TempFile
- java.lang.Object
-
- org.apache.poi.util.TempFile
-
public final class TempFile extends java.lang.ObjectInterface for creating temporary files. Collects them all into one directory by default.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classTempFile.DefaultTempFileCreationStrategyDefault implementation of theTempFileCreationStrategyused byTempFile: Files are collected into one directory and by default are deleted on exit from the VM.
-
Constructor Summary
Constructors Constructor and Description TempFile()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.io.FilecreateTempFile(java.lang.String prefix, java.lang.String suffix)Creates a new and empty temporary file.static voidsetTempFileCreationStrategy(TempFileCreationStrategy strategy)Configures the strategy used bycreateTempFile(String, String)to create the temporary files.
-
-
-
Method Detail
-
setTempFileCreationStrategy
public static void setTempFileCreationStrategy(TempFileCreationStrategy strategy)
Configures the strategy used bycreateTempFile(String, String)to create the temporary files.- Parameters:
strategy- The new strategy to be used to create the temporary files.- Throws:
java.lang.IllegalArgumentException- When the given strategy isnull.
-
createTempFile
public static java.io.File createTempFile(java.lang.String prefix, java.lang.String suffix) throws java.io.IOExceptionCreates a new and empty temporary file. By default, files are collected into one directory and are deleted on exit from the VM, although they can be kept by defining the system propertypoi.keep.tmp.files(seeTempFile.DefaultTempFileCreationStrategy).Don't forget to close all files or it might not be possible to delete them.
- Parameters:
prefix- The prefix to be used to generate the name of the temporary file.suffix- The suffix to be used to generate the name of the temporary file.- Returns:
- The path to the newly created and empty temporary file.
- Throws:
java.io.IOException- If no temporary file could be created.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG