02/28/2005
 

com.epicentric.common
Class FileUtils

java.lang.Object
  |
  +--com.epicentric.common.FileUtils

Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced by class FileUtils.

public class FileUtils
extends Object

File management utilities.


Constructor Summary
FileUtils()
          Deprecated.  
 
Method Summary
static String appendSlash(String dir)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.appendSlash(String).
static void copy(File source, File destination)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.copy(File, File).
static void create(File file)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static boolean delete(File file)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.delete(File).
static boolean deleteDirectoryContents(File file)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.deleteDirectoryContents(File).
static boolean deleteFileAndEmptyDirectory(File file)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
static String fixSlashes(String str)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.fixSlashes(String).
static String generateUniqueName()
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.generateUniqueName().
static String getAbstract(File file)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
static String getAbstract(String file_path)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
static String[] getDirectoryFiles(File dir)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
static Vector getFilenames(File dir, Vector files)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static String getFilePath(String directory, String file_name, String suffix)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
static URL getFileURL(File file)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No Replacement.
static URL getFileURL(File dir, String file_name)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static URL getFileURL(String file_path)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.toFileURL(String).
static long getTotalFileSize(File file)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
static boolean isAbsolutePath(String path)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
static boolean isRelativePath(String path)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
static boolean isValidDirectory(String dirName)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
static void makeParentDir(File file)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
static void makeParentDir(String file_path)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
static String stripFilename(String filename)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Deprecated. 
Method Detail

copy

public static void copy(File source,
                        File destination)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.copy(File, File).

Copy the source file or directory to the destination. Does not delete the destination if it already exists.

delete

public static boolean delete(File file)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.delete(File).

Delete the given file or directory, recursively.

If there's an error, continue to try to delete all files it can possibly delete.

deleteDirectoryContents

public static boolean deleteDirectoryContents(File file)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.deleteDirectoryContents(File).

Delete the files and subdirectories of the given directory, recursively. This will not delete the directory itself, however.

If there's an error, continue to try to delete all files it can possibly delete. This will return 'false' if 'file' is not a directory.

getFilenames

public static Vector getFilenames(File dir,
                                  Vector files)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

Recursively add given dir's child filenames (Strings) to given vector.

Return given vector as a convenience.

Do not return directory names.

Return paths relative to the initial directory, not absolute.

getFileURL

public static URL getFileURL(String file_path)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.toFileURL(String).


getFileURL

public static URL getFileURL(File file)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No Replacement.


getFileURL

public static URL getFileURL(File dir,
                             String file_name)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.


getFilePath

public static String getFilePath(String directory,
                                 String file_name,
                                 String suffix)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement


stripFilename

public static String stripFilename(String filename)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement

Strip any filename off the end of the given string, leaving any directories. Leaves the final "/". Works on paths with / or \. Works for URLs, too, such as http://host/whatever, which becomes http://host/.

makeParentDir

public static void makeParentDir(String file_path)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement

Convert string into File and pass to makeParentDir(File)

makeParentDir

public static void makeParentDir(File file)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement

Create all the parent directories under the specified file, if they do not already exist. Note that if file.isDirectory(), it will NOT create the top directory, only the parent directories.

isRelativePath

public static boolean isRelativePath(String path)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement

Return whether the string is a relative file path.
Returns:
false if an absolute path or null

isAbsolutePath

public static boolean isAbsolutePath(String path)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement

Return whether the string is an absolute file path. Note since this does not actually create a physical file, it cannot guarantee the path is a valid one. Invalid paths typically think they are relative.
Returns:
true if an absolute path, false if relative path or null

create

public static void create(File file)
                   throws IOException
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

Creates given file if it doesn't exist. Does nothing if given file already exists.

Reason for this method: if a file doesn't already exist then when it is written to, an exception occurs. This writes an initial blank byte to the file, to get the file to exist.

generateUniqueName

public static String generateUniqueName()
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.generateUniqueName().

Generate a file name that's unique through all calls to this method (assuming nobody tampers with the clock).

fixSlashes

public static String fixSlashes(String str)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.fixSlashes(String).

Change any forward or backward slashes into the File.seperator.

appendSlash

public static String appendSlash(String dir)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with FileUtils.appendSlash(String).

Add a trailing slash (File.separator) on given string to make it a directory. Does not add slash if one exists.

The returned string is a new String -- it will never be the same object as the dir parameter.

Returns slash if dir is null or is whitespace.

getDirectoryFiles

public static String[] getDirectoryFiles(File dir)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement

Return array of file names in given directory (doesn't include subdirectories).

getAbstract

public static String getAbstract(String file_path)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement

Calls through to getAbstract(File).
See Also:
FileUtils.getAbstract(File)

getAbstract

public static String getAbstract(File file)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement

Returns the first 4096 bytes of the given file, returning "" if the file doesn't exist.

getTotalFileSize

public static long getTotalFileSize(File file)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement

Return the total size of 'file'. This method will take subdirectories into account if 'file' is a directory. This will return '0' if 'file' is not valid.

isValidDirectory

public static boolean isValidDirectory(String dirName)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement

Verify that the directory dirName exists.

deleteFileAndEmptyDirectory

public static boolean deleteFileAndEmptyDirectory(File file)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement

Recursively delete the file and directory that the file resides in if the input File is a file, or for the directory if the input File is a directory

02/28/2005
 

Copyright and Trademark Notices