allensoft.util
Class FileUtilities

java.lang.Object
  |
  +--allensoft.util.FileUtilities

public class FileUtilities
extends java.lang.Object


Constructor Summary
FileUtilities()
           
 
Method Summary
static boolean areFileNamesCaseSensitive()
          Checks if file names are case sensitive on the host operating system.
static void copyFile(java.io.File source, java.io.File destination)
           
static boolean deleteFiles(java.io.File file)
          Deletes a file recursively.
static java.io.File getCommonParent(java.io.File file1, java.io.File file2)
           
static java.io.File getFileFromRelativePath(java.io.File base, java.lang.String sRelativePath)
           
static java.io.File getFileFromRelativePath(java.io.File base, java.lang.String sRelativePath, java.lang.String sParent, java.lang.String sCurrentDir)
           
static java.io.File getFileFromRelativePath(java.io.File base, java.lang.String sRelativePath, java.lang.String sParent, java.lang.String sCurrentDir, java.lang.String sSeparator)
           
static java.io.File[] getFiles(java.lang.String sFiles)
           
static java.io.File[] getFiles(java.lang.String sFiles, java.io.File currentDirectory)
           
static java.io.File[] getFiles(java.lang.String sFiles, java.io.File currentDirectory, java.lang.String sFileSeparator)
           
static java.io.File[] getFiles(java.lang.String sFiles, java.io.File currentDirectory, java.lang.String sFileSeparator, boolean bAllowWildChars)
          Gets an array of files from a string.
static java.lang.String getRelativePath(java.io.File file1, java.io.File file2)
           
static java.lang.String getRelativePath(java.io.File file1, java.io.File file2, java.lang.String sParent)
          Gets the realtive path from the supplied current directory to the supplied file.
static java.lang.String getRelativePath(java.io.File file1, java.io.File file2, java.lang.String sParent, java.lang.String sSeparator)
          Gets the realtive path from the supplied current directory to the supplied file.
static boolean isParentOf(java.io.File file1, java.io.File file2)
           
static void listFilesRecursively(java.io.File directory, java.io.FileFilter filter, java.util.Collection collection, java.io.FileFilter directoryFilter)
          Lists files recursively adding them to the specified collection.
static java.io.File[] listFilesRecursively(java.io.File directory, java.io.FileFilter filter, java.io.FileFilter directoryFilter)
          Lists all files that match the filter recursively.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtilities

public FileUtilities()
Method Detail

listFilesRecursively

public static java.io.File[] listFilesRecursively(java.io.File directory,
                                                  java.io.FileFilter filter,
                                                  java.io.FileFilter directoryFilter)
Lists all files that match the filter recursively.

listFilesRecursively

public static void listFilesRecursively(java.io.File directory,
                                        java.io.FileFilter filter,
                                        java.util.Collection collection,
                                        java.io.FileFilter directoryFilter)
Lists files recursively adding them to the specified collection.

deleteFiles

public static boolean deleteFiles(java.io.File file)
Deletes a file recursively. If the file is a directory the contents of the directory are also deleted.
Returns:
true if all files were successful deleted or false if one or more weren't.

getRelativePath

public static java.lang.String getRelativePath(java.io.File file1,
                                               java.io.File file2,
                                               java.lang.String sParent,
                                               java.lang.String sSeparator)
Gets the realtive path from the supplied current directory to the supplied file. Relative paths are separated using the supplied separator.

getRelativePath

public static java.lang.String getRelativePath(java.io.File file1,
                                               java.io.File file2,
                                               java.lang.String sParent)
Gets the realtive path from the supplied current directory to the supplied file. Relative paths are separated using the file separator for the current platform.

getRelativePath

public static java.lang.String getRelativePath(java.io.File file1,
                                               java.io.File file2)

isParentOf

public static boolean isParentOf(java.io.File file1,
                                 java.io.File file2)

getCommonParent

public static java.io.File getCommonParent(java.io.File file1,
                                           java.io.File file2)

getFileFromRelativePath

public static java.io.File getFileFromRelativePath(java.io.File base,
                                                   java.lang.String sRelativePath,
                                                   java.lang.String sParent,
                                                   java.lang.String sCurrentDir,
                                                   java.lang.String sSeparator)

getFileFromRelativePath

public static java.io.File getFileFromRelativePath(java.io.File base,
                                                   java.lang.String sRelativePath,
                                                   java.lang.String sParent,
                                                   java.lang.String sCurrentDir)

getFileFromRelativePath

public static java.io.File getFileFromRelativePath(java.io.File base,
                                                   java.lang.String sRelativePath)

copyFile

public static void copyFile(java.io.File source,
                            java.io.File destination)
                     throws java.io.IOException

areFileNamesCaseSensitive

public static boolean areFileNamesCaseSensitive()
Checks if file names are case sensitive on the host operating system.

getFiles

public static java.io.File[] getFiles(java.lang.String sFiles,
                                      java.io.File currentDirectory,
                                      java.lang.String sFileSeparator,
                                      boolean bAllowWildChars)
Gets an array of files from a string. The string can contain quoted characters to specify file names with spaces in them. A wild character of '*' can be used to specify file patterns.

getFiles

public static java.io.File[] getFiles(java.lang.String sFiles,
                                      java.io.File currentDirectory,
                                      java.lang.String sFileSeparator)

getFiles

public static java.io.File[] getFiles(java.lang.String sFiles,
                                      java.io.File currentDirectory)

getFiles

public static java.io.File[] getFiles(java.lang.String sFiles)