Package io.github.astrapi69.file.create
Class FileFactory
java.lang.Object
io.github.astrapi69.file.create.FileFactory
The class
FileFactory
helps you to create files-
Method Summary
Modifier and TypeMethodDescriptionstatic File
static FileCreationState
Factory method that creates a new emptyFile
if it is not exists, otherwise it lets the file as it is.static File
Factory method for creating the newFile
if it is not exists.static 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
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
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 is not exists, otherwise it lets the file as it is.static File
newFileQuietly
(File parentDirectory, String filename) Factory method for creating the newFile
if it is not exists.static 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) 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 parentDirectory, String filename) Factory method for creating the newFile
if it is not exists.static FileCreationState
newFiles
(Collection<File> files) Creates all files contained in the collection as empty files if the files does not exists otherwise it lets the files as they are.static FileCreationState
newFilesQuietly
(Collection<File> files) Creates all files contained in the collection as empty files if the files does not exists otherwise it lets the files as they are.
-
Method Details
-
newFile
Factory method that creates a new emptyFile
if it is not exists, otherwise it lets the file as it is.- Parameters:
file
- the file.- Returns:
- the appropriate state object that describes what happen
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
newFileQuietly
Factory method that creates a new emptyFile
if it is not exists, otherwise it lets the file as it is.- Parameters:
file
- the file.- Returns:
- the appropriate state object that describes what happen
-
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
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 pathcreateIfNotExists
- if this flag is true the file will be created if it does not exists- 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 pathcreateIfNotExists
- if this flag is true the file will be created if it does not exists- Returns:
- the 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
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 contained in the collection as empty files if the files does not exists otherwise it lets the files as they are.- Parameters:
files
- the Collection with the File objects.- Returns:
- the
FileCreationState
object that encapsulate the creation result - Throws:
IOException
- Signals that an I/O exception has occurred.
-
newFilesQuietly
Creates all files contained in the collection as empty files if the files does not exists otherwise it lets the files as they are.- Parameters:
files
- the Collection with the File objects.- Returns:
- the
FileCreationState
object that encapsulate the creation result
-