Package org.wso2.carbon.utils
Class FileUtils
- java.lang.Object
-
- org.wso2.carbon.utils.FileUtils
-
public class FileUtils extends Object
File Utilities.- Since:
- 1.0.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopyFile(File source, File destination)Copies source file to destination file.static voidcopyFileToDir(File source, File destination)Copies src file to dst directory.static booleandeleteDir(File dir)Deletes all files and subdirectories under dir.
-
-
-
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 filedestination- 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 copieddestination- The destination directory to which the file has to be copied- Throws:
IOException- If an error occurs while copying
-
-