Package org.jorigin.io
Class FileUtil
- java.lang.Object
-
- org.jorigin.io.FileUtil
-
public class FileUtil extends java.lang.ObjectA file management API. This Class provide simple and efficient file management methods.- Since:
- 1.0.0
- Author:
- Julien Seinturier - (c) 2009 - JOrigin project - http:/www.jorigin.org
-
-
Constructor Summary
Constructors Constructor Description FileUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancopy(java.io.File source, java.io.File destination)Simple copy of a source file to a destination filestatic booleancopyDirectory(java.io.File source, java.io.File destination)Copying recursively a directory to another.static booleandeleteDirectory(java.io.File path)Delete recursively a directory.static java.util.ArrayList<java.io.File>listFiles(java.io.File source, java.io.FileFilter filter)List recursively a directory and its sub-directories.static longsize(java.io.File path)Return the file or directory size in byte
-
-
-
Method Detail
-
size
public static long size(java.io.File path)
Return the file or directory size in byte- Parameters:
path- the file or directory to check- Returns:
- the complete size in bytes of the file or directory.
-
deleteDirectory
public static boolean deleteDirectory(java.io.File path)
Delete recursively a directory.- Parameters:
path- path to the directory (or file) you want to delete- Returns:
trueif the delete was successfull andfalseif the delete was unable to erase all the directory
-
copy
public static boolean copy(java.io.File source, java.io.File destination)Simple copy of a source file to a destination file- Parameters:
source- the path of the source filedestination- the path of the destination file- Returns:
trueif the copy was successfull andfalseif not
-
copyDirectory
public static boolean copyDirectory(java.io.File source, java.io.File destination)Copying recursively a directory to another. If the destination directory does not exist, it is created.- Parameters:
source- the source directory (or file to copy)destination- the destination directory.- Returns:
trueif the copy was successfull,falseif the copy was unsuccessfull
-
listFiles
public static java.util.ArrayList<java.io.File> listFiles(java.io.File source, java.io.FileFilter filter)List recursively a directory and its sub-directories.- Parameters:
source- the source directory (or file to copy).filter- afilterused for accepting files within the list.- Returns:
- the list of files presents in the directory.
-
-