| java.lang.Object org.netbeans.modules.iep.project.anttasks.DirectoryUtil
DirectoryUtil | public class DirectoryUtil extends Object (Code) | | author: Bing Lu |
Method Summary | |
public static String | buildFullPath(String aDir, String aFileName) this util method construct the absolute path from its parts. | public static boolean | copyFile(File source, File dest) Copy one file's contents to another file.
Parameters: source - The file to copy. Parameters: dest - The file to copy to. | public static boolean | copyFile(String source, String destDir) | public static void | copyFilesInDir(File sourceDir, File targetDir, FileFilter filter, boolean recursive) | public static void | copyStream(InputStream is, OutputStream os) | public static void | copyStream(Reader r, Writer w) | public static void | copyTree(File sourceDir, File targetDir, String[] excludeExt) This method copies recursively copies all the files in a directory to
another directory, maintaining the source directory's child directory
structure. | public static boolean | createDir(String dirName) This method will create a directory and its parent directories. | public static boolean | deleteDir(String dirName) This method will recursively delete a directory and all its files and
subdirectories. | public static boolean | deleteDir(File dir) This method will recursively delete a directory and all its files and
subdirectories. | public static boolean | deleteDir(File dir, boolean deleteOriginalDir) This method will recursively delete a directory and all its files and
subdirectories.
Parameters: dir - The directory to delete Parameters: deleteOriginalDir - Whether or not to delete the original directory. | public static boolean | deleteFile(String filename) This method will delete a single file.
Parameters: filename - Full pathname of the file to delete. | public static boolean | deleteFile(String filename, String dirName) This method will delete a single file.
Parameters: filename - Name of the file. Parameters: dirName - Directory where the file can be found. | public static boolean | dirExists(String dirName) This method will check if a file exists.
Parameters: dirName - Full pathname of the directory. | public static boolean | fileExists(String filename) This method will check if a file exists.
Parameters: filename - Full pathname of the file. | public static List | getFiles(String fromDir) This method will return an arraylist containing all the file/s name/s in
the provided directory name
Parameters: fromDir - Current directory where files are located. | public static List | getFilesRecursively(File dir, FileFilter filter) | public static List | getFilesRecursively(File dir, String[] extensions) | public static boolean | moveFile(String filename, String toDir) This method will move a single file from one directory to another.
Parameters: filename - Full path name of the file. Parameters: toDir - Directory where to move file to. | public static boolean | moveFile(File file, String toDir) This method will move a single file from one directory to another. | public static boolean | moveFile(String filename, String fromDir, String toDir) This method will more a single file from one directory to another.
Parameters: filename - Name of the file. Parameters: fromDir - Current directory where file is located. Parameters: toDir - Directory where to move file to. | public static void | moveFilesInDir(File sourceDir, File targetDir, FileFilter filter, boolean recursive) | public static void | moveTree(File sourceDir, File targetDir, String[] excludeExt) |
DirectoryUtil | public DirectoryUtil()(Code) | | Creates new DirectoryUtil
|
buildFullPath | public static String buildFullPath(String aDir, String aFileName)(Code) | | this util method construct the absolute path from its parts. it will
remove any preamble to the file name prior to concatenate the path
elements.
Parameters: aDir - - the directory part of the absolute path Parameters: aFileName - - the file part of the absolute path string absolute path of the parameters provided. |
copyFile | public static boolean copyFile(File source, File dest)(Code) | | Copy one file's contents to another file.
Parameters: source - The file to copy. Parameters: dest - The file to copy to. true if the copy succeeded, false otherwise. |
copyFile | public static boolean copyFile(String source, String destDir)(Code) | | Parameters: source - source directory to copy Parameters: destDir - target directory where it will be copied to whether copy was successfule or not |
copyFilesInDir | public static void copyFilesInDir(File sourceDir, File targetDir, FileFilter filter, boolean recursive)(Code) | | Parameters: sourceDir - source directory Parameters: targetDir - target directory Parameters: filter - file filter Parameters: recursive - TODO: document me! |
copyTree | public static void copyTree(File sourceDir, File targetDir, String[] excludeExt)(Code) | | This method copies recursively copies all the files in a directory to
another directory, maintaining the source directory's child directory
structure. If any particular file type should be excluded, it's extension
may be specified using the excludeExt argument.
Parameters: sourceDir - The directory to copy files from. Parameters: targetDir - The directory to copy files to. Parameters: excludeExt - Array of string extensions of form .ext to exclude fromthe copy. |
createDir | public static boolean createDir(String dirName)(Code) | | This method will create a directory and its parent directories. The
specified directory cannot be created if a file exists with the same
name.
Parameters: dirName - Full pathname of directory to be created. boolean Returns true if directory already exists or was createdsucessfully, false otherwise. |
deleteDir | public static boolean deleteDir(String dirName)(Code) | | This method will recursively delete a directory and all its files and
subdirectories.
Parameters: dirName - The full path of the directory to delete Returns true if directory was deleted, false otherwise. |
deleteDir | public static boolean deleteDir(File dir)(Code) | | This method will recursively delete a directory and all its files and
subdirectories.
Parameters: dir - The directory to delete Returns true if directory was deleted, false otherwise. |
deleteDir | public static boolean deleteDir(File dir, boolean deleteOriginalDir)(Code) | | This method will recursively delete a directory and all its files and
subdirectories.
Parameters: dir - The directory to delete Parameters: deleteOriginalDir - Whether or not to delete the original directory. Returns true if directory was deleted, false otherwise. |
deleteFile | public static boolean deleteFile(String filename)(Code) | | This method will delete a single file.
Parameters: filename - Full pathname of the file to delete. boolean Returns true if file was deleted, false otherwise. |
deleteFile | public static boolean deleteFile(String filename, String dirName)(Code) | | This method will delete a single file.
Parameters: filename - Name of the file. Parameters: dirName - Directory where the file can be found. boolean Returns true if file was deleted, false otherwise. |
dirExists | public static boolean dirExists(String dirName)(Code) | | This method will check if a file exists.
Parameters: dirName - Full pathname of the directory. boolean Returns true if the directory exists, false otherwise |
fileExists | public static boolean fileExists(String filename)(Code) | | This method will check if a file exists.
Parameters: filename - Full pathname of the file. boolean Returns true if the file exists and is not a directory,false otherwise |
getFiles | public static List getFiles(String fromDir)(Code) | | This method will return an arraylist containing all the file/s name/s in
the provided directory name
Parameters: fromDir - Current directory where files are located. ArrayList - could be zero in length if directory is empty or nofound. |
moveFile | public static boolean moveFile(String filename, String toDir)(Code) | | This method will move a single file from one directory to another.
Parameters: filename - Full path name of the file. Parameters: toDir - Directory where to move file to. boolean Returns true if file was moved successfully, falseotherwise. |
moveFile | public static boolean moveFile(File file, String toDir)(Code) | | This method will move a single file from one directory to another.
Parameters: toDir - Directory where to move file to. Parameters: file - file that will be moved boolean Returns true if file was moved successfully, falseotherwise. |
moveFile | public static boolean moveFile(String filename, String fromDir, String toDir)(Code) | | This method will more a single file from one directory to another.
Parameters: filename - Name of the file. Parameters: fromDir - Current directory where file is located. Parameters: toDir - Directory where to move file to. boolean Returns true if file was moved successfully, falseotherwise. |
moveFilesInDir | public static void moveFilesInDir(File sourceDir, File targetDir, FileFilter filter, boolean recursive)(Code) | | Parameters: sourceDir - source directory Parameters: targetDir - target directory Parameters: filter - file filter Parameters: recursive - TODO: document me! |
moveTree | public static void moveTree(File sourceDir, File targetDir, String[] excludeExt)(Code) | | Parameters: sourceDir - source dir to be moved Parameters: targetDir - target : where it will be moved to Parameters: excludeExt - exclude files with these extension for the move |
|
|