|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectPath
public class Path
The Path
class provides a number of utilities that makes
working with file system paths easier. This class is effectively a
"package" in that all its members are static, and do not rely on
instance variables.
Field Summary | |
---|---|
static Tester |
tester
|
Constructor Summary | |
---|---|
Path()
|
Method Summary | |
---|---|
static String |
calcPrefix(String longPath,
String shortPath)
Find the part of the long path that, when all symbolic links are fully resolved, maps to the short path (when the short path also is fully resolved.) |
static void |
copyFile(File src,
File dst)
Copies a source file to the specified destination. |
static boolean |
createPath(String path)
Create the specified file system path. |
static void |
deleteDir(File dir)
Utility function to delete a specified directory and all its files and subdirectories. |
static boolean |
deletePath(String path)
Remove the specified path from the file system. |
static String |
normalize(String pathOrFileName)
Normalize a path or file name. |
static String |
normalizeFileName(String path)
Normalize a file name. |
static String |
normalizePath(String path)
Normalize the specified file system path. |
static String |
resolveRelOrAbs(File parentDir,
String childPath)
Utility function to resolve a child path against a parent path. |
static String |
resolveRelOrAbs(String parentDir,
String childPath)
Utility function to resolve a child path against a parent path. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Tester tester
Constructor Detail |
---|
public Path()
Method Detail |
---|
public static final String normalizePath(String path)
path
- The path to normalize. public static final String normalizeFileName(String path)
path
- The file name (optionally preceeded by a path)
to normalize. normalizePath()
function to normalize the filename and path (if any), and then
simply removes the trailing slash.public static final String normalize(String pathOrFileName)
pathOrFileName
- The path or file name (optionally preceeded by
a path) to normalize. normalizePath()
function to normalize the filename and path (if any). If the original
path ended with a slash, the new one will also. If not, the new one
will not.public static final boolean createPath(String path)
path
- The file system path to create. true
- The file system path was successfully created. false
- An file system path was not created
due to errors. normalizePath()
to help ensure the
successful creation of the specified path. public static final boolean deletePath(String path)
path
- The file system path to remove. true
- Part or all of the specified path was removed. false
- None of the specified path could be removed
(either because none of the directories in the
path were empty, or because of other errors.)
public static final String calcPrefix(String longPath, String shortPath) throws IOException
IOException
public static void deleteDir(File dir) throws IOException
IOException
- if we fail to delete the entire directory and all
sub-files and subdirectories.public static String resolveRelOrAbs(File parentDir, String childPath)
parentDir
- - Directory against which to resolve the child,
if the child is a relative path.childPath
- - An absolute path, or else a relative path to
resolve against parentFile
.
public static String resolveRelOrAbs(String parentDir, String childPath)
parentDir
- - Directory against which to resolve the child,
if the child is a relative path.childPath
- - An absolute path, or else a relative path to
resolve against parentFile
.
public static void copyFile(File src, File dst) throws IOException
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |