Module file.worker

Class FileFactory


  • public final class FileFactory
    extends java.lang.Object
    The class FileFactory helps you to create files
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.File newFile​(FileInfo fileInfo)
      Factory method for creating the new File from the given FileInfo object
      static FileCreationState newFile​(java.io.File file)
      Factory method that creates a new empty File if it is not exists, otherwise it lets the file as it is.
      static java.io.File newFile​(java.io.File parentDirectory, java.lang.String filename)
      Factory method for creating the new File if it is not exists.
      static java.io.File newFile​(java.lang.String absolutePath)
      Factory method that creates a new File object, if the given boolean flag is true a new empty file will be created on the file system
      static java.io.File newFile​(java.lang.String absolutePath, boolean createIfNotExists)
      Factory method that creates a new File object, if the given boolean flag is true a new empty file will be created on the file system
      static java.io.File newFile​(java.lang.String parentDirectory, java.lang.String filename)
      Factory method for creating the new File if it is not exists.
      static java.io.File newFileQuietly​(FileInfo fileInfo)
      Factory method for creating the new File from the given FileInfo object
      static FileCreationState newFileQuietly​(java.io.File file)
      Factory method that creates a new empty File if it is not exists, otherwise it lets the file as it is.
      static java.io.File newFileQuietly​(java.io.File parentDirectory, java.lang.String filename)
      Factory method for creating the new File if it is not exists.
      static java.io.File newFileQuietly​(java.lang.String absolutePath)
      Factory method that creates a new File object, if the given boolean flag is true a new empty file will be created on the file system
      static java.io.File newFileQuietly​(java.lang.String absolutePath, boolean createIfNotExists)
      Factory method that creates a new File object, if the given boolean flag is true a new empty file will be created on the file system
      static java.io.File newFileQuietly​(java.lang.String parentDirectory, java.lang.String filename)
      Factory method for creating the new File if it is not exists.
      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 FileCreationState newFilesQuietly​(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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • newFile

        public static FileCreationState newFile​(java.io.File file)
                                         throws java.io.IOException
        Factory method that creates a new empty File 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:
        java.io.IOException - Signals that an I/O exception has occurred.
      • newFileQuietly

        public static FileCreationState newFileQuietly​(java.io.File file)
        Factory method that creates a new empty File 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

        public static java.io.File newFile​(java.lang.String absolutePath)
                                    throws java.io.IOException
        Factory method that creates a new File 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:
        java.io.IOException - Signals that an I/O exception has occurred.
      • newFileQuietly

        public static java.io.File newFileQuietly​(java.lang.String absolutePath)
        Factory method that creates a new File 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

        public static java.io.File newFile​(java.lang.String absolutePath,
                                           boolean createIfNotExists)
                                    throws java.io.IOException
        Factory method that creates a new File object, if the given boolean flag is true a new empty file will be created on the file system
        Parameters:
        absolutePath - the absolute path
        createIfNotExists - if this flag is true the file will be created if it does not exists
        Returns:
        the file object
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • newFileQuietly

        public static java.io.File newFileQuietly​(java.lang.String absolutePath,
                                                  boolean createIfNotExists)
        Factory method that creates a new File object, if the given boolean flag is true a new empty file will be created on the file system
        Parameters:
        absolutePath - the absolute path
        createIfNotExists - if this flag is true the file will be created if it does not exists
        Returns:
        the file object
      • newFile

        public static java.io.File newFile​(java.io.File parentDirectory,
                                           java.lang.String filename)
                                    throws java.io.IOException
        Factory method for creating the new File if it is not exists.
        Parameters:
        parentDirectory - the parent directory
        filename - the file name
        Returns:
        the new File object
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • newFileQuietly

        public static java.io.File newFileQuietly​(java.io.File parentDirectory,
                                                  java.lang.String filename)
        Factory method for creating the new File if it is not exists.
        Parameters:
        parentDirectory - the parent directory
        filename - the file name
        Returns:
        the new File object
      • newFile

        public static java.io.File newFile​(java.lang.String parentDirectory,
                                           java.lang.String filename)
                                    throws java.io.IOException
        Factory method for creating the new File if it is not exists.
        Parameters:
        parentDirectory - the parent directory
        filename - the file name
        Returns:
        the new File object
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • newFileQuietly

        public static java.io.File newFileQuietly​(java.lang.String parentDirectory,
                                                  java.lang.String filename)
        Factory method for creating the new File if it is not exists.
        Parameters:
        parentDirectory - the parent directory
        filename - the file name
        Returns:
        the new File object
      • newFile

        public static java.io.File newFile​(FileInfo fileInfo)
                                    throws java.io.IOException
        Factory method for creating the new File from the given FileInfo object
        Parameters:
        fileInfo - the FileInfo object
        Returns:
        the new File object
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • newFileQuietly

        public static java.io.File newFileQuietly​(FileInfo fileInfo)
        Factory method for creating the new File from the given FileInfo object
        Parameters:
        fileInfo - the FileInfo object
        Returns:
        the new File object
      • newFiles

        public static FileCreationState newFiles​(java.util.Collection<java.io.File> files)
                                          throws java.io.IOException
        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:
        java.io.IOException - Signals that an I/O exception has occurred.
      • newFilesQuietly

        public static FileCreationState newFilesQuietly​(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.
        Parameters:
        files - the Collection with the File objects.
        Returns:
        the FileCreationState object that encapsulate the creation result