Package io.github.astrapi69.file.create
Class FileFactory
java.lang.Object
io.github.astrapi69.file.create.FileFactory
The class
FileFactory
provides utility methods for creating files-
Method Summary
Modifier and TypeMethodDescriptionstatic File
static FileCreationState
Factory method that creates a new emptyFile
if it does not exist, otherwise it leaves the file as it isstatic File
Creates a newFile
object in the specified directory if it does not existstatic File
Factory method that creates a newFile
object, if the given boolean flag is true a new empty file will be created on the file systemstatic File
Creates a newFile
object; if the specified flag is true, an empty file is created on the file systemstatic File
Factory method for creating the newFile
if it is not exists.static File
newFileQuietly
(FileInfo fileInfo) static FileCreationState
newFileQuietly
(File file) Factory method that creates a new emptyFile
if it does not exist, otherwise it leaves the file as it isstatic File
newFileQuietly
(File parentDirectory, String filename) Factory method for creating the newFile
object if it does not existstatic File
newFileQuietly
(String absolutePath) Factory method that creates a newFile
object, if the given boolean flag is true a new empty file will be created on the file systemstatic File
newFileQuietly
(String absolutePath, boolean createIfNotExists) Creates a newFile
object; if the specified flag is true, an empty file is created on the file systemstatic File
newFileQuietly
(String parentDirectory, String filename) Factory method for creating the newFile
if it is not exists.static FileCreationState
newFiles
(Collection<File> files) Creates all files in the collection as empty files if they do not exist, otherwise leaves them as they arestatic FileCreationState
newFilesQuietly
(Collection<File> files) Creates all files in the collection as empty files if they do not exist, otherwise leaves them as they are
-
Method Details
-
newFile
Factory method that creates a new emptyFile
if it does not exist, otherwise it leaves the file as it is- Parameters:
file
- the file.- Returns:
- the state describing the creation outcome
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
newFileQuietly
Factory method that creates a new emptyFile
if it does not exist, otherwise it leaves the file as it is- Parameters:
file
- the file- Returns:
- the state describing the creation outcome
-
newFile
Factory method that creates a newFile
object, if the given boolean flag is true a new empty file will be created on the file system- Parameters:
absolutePath
- the absolute path- Returns:
- the file object
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
newFileQuietly
Factory method that creates a newFile
object, if the given boolean flag is true a new empty file will be created on the file system- Parameters:
absolutePath
- the absolute path- Returns:
- the file object
-
newFile
Creates a newFile
object; if the specified flag is true, an empty file is created on the file system- Parameters:
absolutePath
- the absolute pathcreateIfNotExists
- if true, creates the file if it does not exist- Returns:
- the file object
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
newFileQuietly
Creates a newFile
object; if the specified flag is true, an empty file is created on the file system- Parameters:
absolutePath
- the absolute pathcreateIfNotExists
- if true, creates the file if it does not exist- Returns:
- the file object
-
newFile
Creates a newFile
object in the specified directory if it does not exist- Parameters:
parentDirectory
- the parent directoryfilename
- the file name- Returns:
- the new
File
object - Throws:
IOException
- Signals that an I/O exception has occurred.
-
newFileQuietly
Factory method for creating the newFile
object if it does not exist- Parameters:
parentDirectory
- the parent directoryfilename
- the file name- Returns:
- the new
File
object
-
newFile
Factory method for creating the newFile
if it is not exists.- Parameters:
parentDirectory
- the parent directoryfilename
- the file name- Returns:
- the new
File
object - Throws:
IOException
- Signals that an I/O exception has occurred.
-
newFileQuietly
Factory method for creating the newFile
if it is not exists.- Parameters:
parentDirectory
- the parent directoryfilename
- the file name- Returns:
- the new
File
object
-
newFile
- Parameters:
fileInfo
- theFileInfo
object- Returns:
- the new
File
object - Throws:
IOException
- Signals that an I/O exception has occurred.
-
newFileQuietly
-
newFiles
Creates all files in the collection as empty files if they do not exist, otherwise leaves them as they are- Parameters:
files
- the collection ofFile
objects- Returns:
- the
FileCreationState
object representing the overall creation result - Throws:
IOException
- Signals that an I/O exception has occurred.
-
newFilesQuietly
Creates all files in the collection as empty files if they do not exist, otherwise leaves them as they are- Parameters:
files
- the collection ofFile
objects- Returns:
- the
FileCreationState
object representing the overall creation result
-