Package PamUtils
Class FileParts
java.lang.Object
PamUtils.FileParts
Class for breaking a file name down into it's constituent
parts.
- Author:
- Doug Gillespie
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
String[]
static String[]
getFolderPartsBetween
(File aFileOrDir, File aHigherDirectory) static Integer
static boolean
void
setFileName
(String absPath)
-
Constructor Details
-
FileParts
public FileParts() -
FileParts
-
FileParts
-
-
Method Details
-
setFileName
-
getFileName
-
getFolderName
-
getFileEnd
-
getFileNameAndEnd
-
getFolderParts
-
getLastFolderPart
-
getFileSeparator
-
getFolderPartsBetween
- Parameters:
aFileOrDir
-aHigherDirectory
-- Returns:
- Directories between file/dir in question and the higher
directory specified. Returns null if not in the higher directory at all.
NB Uses isWithin!
Add another String to the array with the file/dir name to give a "relative file"
-
isWithin
- Parameters:
aFileOrDir
-aHigherDirectory
-- Returns:
- depth of subfolders of file/dir in higher directory NB: Based on Abstract Paths. If referring to same file through different route, will return false. Eg. with a net drive mapped as both N and M; isWithin(new File("M:\\foo\\bar.txt"),new File("N:\\foo")) will return false!
-
isWithin
- Parameters:
aDir
-deeperFileOrDir
-c
- unused but to make it different from other method!- Returns:
- true if aDir contains deeperFileDir
-