public final class TempFile
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
TempFile.DefaultTempFileCreationStrategy
Default implementation of the
TempFileCreationStrategy used by TempFile :
Files are collected into one directory and by default are deleted on exit from the VM. |
Constructor and Description |
---|
TempFile() |
Modifier and Type | Method and Description |
---|---|
static java.io.File |
createTempFile(java.lang.String prefix,
java.lang.String suffix)
Creates a new and empty temporary file.
|
static void |
setTempFileCreationStrategy(TempFileCreationStrategy strategy)
Configures the strategy used by
createTempFile(String, String) to create the temporary files. |
public static void setTempFileCreationStrategy(TempFileCreationStrategy strategy)
createTempFile(String, String)
to create the temporary files.strategy
- The new strategy to be used to create the temporary files.java.lang.IllegalArgumentException
- When the given strategy is null
.public static java.io.File createTempFile(java.lang.String prefix, java.lang.String suffix) throws java.io.IOException
poi.keep.tmp.files
(see TempFile.DefaultTempFileCreationStrategy
).
Don't forget to close all files or it might not be possible to delete them.
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.java.io.IOException
- If no temporary file could be created.Copyright 2015 The Apache Software Foundation or its licensors, as applicable.