public final class TempFile
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
JAVA_IO_TMPDIR
Define a constant for this property as it is sometimes mistypes as "tempdir" otherwise
(为该属性定义一个常量,因为它有时会被错误输入为“tempdir”,否则)
|
Modifier and Type | Method and Description |
---|---|
static java.io.File |
createTempDirectory(java.lang.String name) |
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.
(配置 createTempFile(String, String) 用于创建临时文件的策略。)
|
public static final java.lang.String JAVA_IO_TMPDIR
public static void setTempFileCreationStrategy(TempFileCreationStrategy strategy)
createTempFile(String, String)
to create the temporary files.
(配置 createTempFile(String, String) 用于创建临时文件的策略。)
strategy
- The new strategy to be used to create the temporary files.
(strategy - 用于创建临时文件的新策略。)
java.lang.IllegalArgumentException
- When the given strategy is
null
.
(java.lang.IllegalArgumentException - 当给定策略为空时。)
public static java.io.File createTempFile(java.lang.String prefix, java.lang.String suffix) throws java.io.IOException
poi.keep.tmp.files
(see
DefaultTempFileCreationStrategy
).
Don't forget to close all files or it might not be possible to delete them.
(创建一个新的空临时文件。默认情况下,文件被收集到一个目录中,并在退出 VM 时被删除,尽管可以通过定义系统属性 poi.keep.tmp.files 来保留它们(参见 DefaultTempFileCreationStrategy)。不要忘记关闭所有文件,否则可能无法删除它们。)prefix
- The prefix to be used to generate the name of the temporary file.
(prefix - 用于生成临时文件名称的前缀。)
suffix
- The suffix to be used to generate the name of the temporary file.
(suffix - 用于生成临时文件名称的后缀。)
java.io.IOException
- If no temporary file could be created.
(java.io.IOException - 如果无法创建临时文件。)
public static java.io.File createTempDirectory(java.lang.String name) throws java.io.IOException
java.io.IOException
(java.io.IOException)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.