类 FileUtils
- java.lang.Object
- org.springframework.batch.item.util.FileUtils
public final class FileUtils extends java.lang.Object
Utility methods for files used in batch processing.- 作者:
- Peter Zozom
方法概要
所有方法 静态方法 具体方法 已过时的方法 修饰符和类型 方法 说明 static boolean
createNewFile(java.io.File file)
Create a new file if it doesn't already exist.static void
setUpOutputFile(java.io.File file, boolean restarted, boolean overwriteOutputFile)
已过时。use the version with explicit append parameter instead.static void
setUpOutputFile(java.io.File file, boolean restarted, boolean append, boolean overwriteOutputFile)
Set up output file for batch processing.
方法详细资料
setUpOutputFile
public static void setUpOutputFile(java.io.File file, boolean restarted, boolean append, boolean overwriteOutputFile)
Set up output file for batch processing. This method implements common logic for handling output files when starting or restarting file I/O. When starting output file processing, creates/overwrites new file. When restarting output file processing, checks whether file is writable.- 参数:
file
- file to be set uprestarted
- true signals that we are restarting output file processingappend
- true signals input file may already exist (but doesn't have to)overwriteOutputFile
- If set to true, output file will be overwritten (this flag is ignored when processing is restart)
setUpOutputFile
@Deprecated public static void setUpOutputFile(java.io.File file, boolean restarted, boolean overwriteOutputFile)
已过时。use the version with explicit append parameter instead. Here append=false is assumed.Set up output file for batch processing. This method implements common logic for handling output files when starting or restarting file I/O. When starting output file processing, creates/overwrites new file. When restarting output file processing, checks whether file is writable.- 参数:
file
- file to be set uprestarted
- true signals that we are restarting output file processingoverwriteOutputFile
- If set to true, output file will be overwritten (this flag is ignored when processing is restart)- 抛出:
java.lang.IllegalArgumentException
- when file is nullItemStreamException
- when starting output file processing, file exists and flag "overwriteOutputFile" is set to falseItemStreamException
- when unable to create file or file is not writable
createNewFile
public static boolean createNewFile(java.io.File file) throws java.io.IOException
Create a new file if it doesn't already exist.- 参数:
file
- the file to create on the filesystem- 返回:
- true if file was created else false.
- 抛出:
java.io.IOException
- is thrown if error occurs during creation and file does not exist.