public final class FileFactory
extends java.lang.Object
FileFactory helps you to create files or directories| Modifier and Type | Method and Description |
|---|---|
static FileCreationState |
newDirectories(java.util.Collection<java.io.File> directories)
Creates the directories.
|
static boolean |
newDirectories(java.nio.file.Path dir,
java.nio.file.attribute.FileAttribute<?>... attrs)
Creates a new directory from the given
Path object and the optional
FileAttribute. |
static FileCreationState |
newDirectory(java.io.File dir)
Creates a new directory from the given
File object |
static boolean |
newDirectory(java.nio.file.Path dir,
java.nio.file.attribute.FileAttribute<?>... attrs)
Creates a new directory from the given
Path object and the optional
FileAttribute. |
static FileCreationState |
newFile(java.io.File file)
Creates an empty file if the File does not exists otherwise it lets the file as it is.
|
static FileCreationState |
newFiles(java.util.Collection<java.io.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 void |
newParentDirectories(java.io.File file)
Creates the parent directories from the given file.
|
public static FileCreationState newDirectories(java.util.Collection<java.io.File> directories) throws DirectoryAlreadyExistsException
directories - the directoriesDirectoryAlreadyExistsException - the directory allready exists exceptionpublic static boolean newDirectories(java.nio.file.Path dir,
java.nio.file.attribute.FileAttribute<?>... attrs)
throws java.io.IOException
Path object and the optional
FileAttribute.Files.createDirectories(Path, FileAttribute...) and
returns if the directory is created or not.dir - the dir the directory to createattrs - an optional list of file attributes to set atomically when creating the directoryjava.io.IOException - Signals that an I/O exception has occurred.Files#createDirectories(Path, FileAttribute...)public static FileCreationState newDirectory(java.io.File dir)
File objectdir - The directory to createFileCreationState with the resultpublic static boolean newDirectory(java.nio.file.Path dir,
java.nio.file.attribute.FileAttribute<?>... attrs)
throws java.io.IOException
Path object and the optional
FileAttribute.Files.createDirectory(Path, FileAttribute...) and
returns if the directory is created or not.dir - the dir the directory to createattrs - an optional list of file attributes to set atomically when creating the directoryjava.io.IOException - Signals that an I/O exception has occurred.Files#createDirectory(Path, FileAttribute...)public static FileCreationState newFile(java.io.File file) throws java.io.IOException
file - the file.java.io.IOException - Signals that an I/O exception has occurred.public static FileCreationState newFiles(java.util.Collection<java.io.File> files) throws java.io.IOException
files - the Collection with the File objects.java.io.IOException - Signals that an I/O exception has occurred.public static void newParentDirectories(java.io.File file)
file - the file