Class FileUtils
java.lang.Object
org.springframework.batch.item.util.FileUtils
Utility methods for files used in batch processing.
- Author:
- Peter Zozom, Mahmoud Ben Hassine
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
createNewFile
(File file) Create a new file if it doesn't already exist.static void
setUpOutputFile
(File file, boolean restarted, boolean append, boolean overwriteOutputFile) Set up output file for batch processing.
-
Method Details
-
setUpOutputFile
public static void setUpOutputFile(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.- Parameters:
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)
-
createNewFile
Create a new file if it doesn't already exist.- Parameters:
file
- the file to create on the filesystem- Returns:
- true if file was created else false.
- Throws:
IOException
- is thrown if error occurs during creation and file does not exist.
-