Class FileUtils


  • public class FileUtils
    extends Object
    File Utilities.
    Since:
    1.0.0
    • Method Detail

      • deleteDir

        public static boolean deleteDir​(File dir)
        Deletes all files and subdirectories under dir. Returns true if all deletions were successful. If a deletion fails, the method stops attempting to delete and returns false.
        Parameters:
        dir - The directory to be deleted
        Returns:
        true if the directory and its descendents were deleted
      • copyFile

        public static void copyFile​(File source,
                                    File destination)
                             throws IOException
        Copies source file to destination file. If the dst file does not exist, it is created
        Parameters:
        source - The source file
        destination - The destination file
        Throws:
        IOException - If an Exception occurs while copying
      • copyFileToDir

        public static void copyFileToDir​(File source,
                                         File destination)
                                  throws IOException
        Copies src file to dst directory. If the dst directory does not exist, it is created
        Parameters:
        source - The file to be copied
        destination - The destination directory to which the file has to be copied
        Throws:
        IOException - If an error occurs while copying