|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdlife.sys.FileSystemUtilities
public final class FileSystemUtilities
This class provides some general utility methods for working with files and directories. In particular some methods help in obtaining lists of files and classes from directories or from the dlife package.
| Constructor Summary | |
|---|---|
FileSystemUtilities()
|
|
| Method Summary | |
|---|---|
static void |
copyFile(String f1,
String f2)
Copy the contents of one file to another file. |
static void |
deleteDirectory(String path)
Delete the specified directory and all of its contents. |
static ArrayList<String> |
getAllDLifeSubClasses(String superClass)
Get a list the fully qualified names of all of the concrete sub classes of the specified super class within the dlife package. |
static String[] |
getDirectoryListing(String dirPath)
Get a list of all of the files in the specified directory. |
static String |
getDLifeClassPathEntry()
Get the entry from the current classpath that corresponds to the dlife package. |
static String |
getDlifeHome(String classPath)
Given the dLife class path entry this method finds dlife's home directory. |
static String |
getFilename(String fullPath)
Get the filename from a full path. |
static String |
getPath(String fullPath)
Get the path from a full path to a file. |
static String[] |
getPathAndName(String fullPath)
Given an absolute path to a .class file, this method returns an Array of two Strings containing the classpath to the package that holds the class and the fully qualified class name. |
static String |
getPathForJavaSourceFile(String javaSourceFile)
Determine the path to the specified java source file accounting for the possibility that the java source file contains a package statement. |
static String |
getPathFromBinaryName(String binaryName)
Given a binary name for a class (e.g. |
static ArrayList<String> |
getRecursiveDirectoryListing(String dirPath)
Get a list of all of the fully qualified filename for all files in all subdirectories of the specified directory. |
static void |
main(String[] args)
A little test method that finds and displays all of the sub-classes of dlife.robot.Robot. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileSystemUtilities()
| Method Detail |
|---|
public static String getDLifeClassPathEntry()
public static String getDlifeHome(String classPath)
public static ArrayList<String> getAllDLifeSubClasses(String superClass)
superClass - the fully qualified name of the super class (e.g.
dlife.robot.Robot).
public static ArrayList<String> getRecursiveDirectoryListing(String dirPath)
dirPath - the path to the directory to recurse.
public static String[] getDirectoryListing(String dirPath)
dirPath - the directory for which to get the listing.
public static void main(String[] args)
args - none.
public static String[] getPathAndName(String fullPath)
throws ClassNotFoundException
fullPath - the absolute pathname to the .class file.
ClassNotFoundException - if the fullPath can not successfully be
split into a path and a fully qualified class name. This
should only ever happen if the specified fullPath does not
point to a valid class file.
IllegalArgumentException - if the fullPath specified is not a full
path.public static String getPathFromBinaryName(String binaryName)
public static String getFilename(String fullPath)
fullPath - the full path to the file.
IllegalArgumentException - if fullPath ends in a /public static String getPath(String fullPath)
fullPath - the full path to the file
IllegalArgumentException - if fullPath ends in a /public static String getPathForJavaSourceFile(String javaSourceFile)
javaSourceFile - the path to a java source code file.
IllegalArgumentException - if the file does not exist.public static void deleteDirectory(String path)
path - the path to the directory.
IllegalArgumentException - if path is not a directory.
public static void copyFile(String f1,
String f2)
throws IOException
f1 - the full path to the file to be copied.f2 - the full path of the new file to be created. If f2 exists
its contents will be replaced by those of f1.
IOException - if there is an error copying the file.
FileNotFoundException - if file f1 does not exist.
|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||