|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.marringtons.file.Path
Static helper class for working with file paths - holding home, temporary and user paths with methods to add, retrieve, make absolute, make relative and split paths.
| Field Summary | |
static String |
homeDir
User home directory. |
static String |
tempDir
Directory for creating temporary files. |
static String |
userDir
Current directory when application started. |
| Method Summary | |
static boolean |
add(String path)
add paths to the datapath used to get files. |
static void |
addPaths(String pathString)
add paths to the datapath used to get files. |
static String |
get(String name)
Retrieve the path from a path/name string. |
static String[] |
getAll()
retrieve data paths in ascending order of importance. |
static String[] |
getBases(String path)
Return a list of base paths for a directory or zip/jar on the datapath. |
static boolean |
isAbsolute(String path)
See if the path os absolute or relative. |
static String |
localiseFileSeparator(String namePath)
Change / to system dependant file separator. |
static String |
makeAbsolute(String path)
Given an unknown path make it absolute if it is not alread so. |
static String |
makeRelative(String fullName)
Return a path relative to the base directory being used. |
static String |
normaliseFileSeparator(String namePath)
Change system dependant file separators to /. |
static String |
removeRelative(String namePath)
Use after concatenating root path to a relative path, such that "/tmp/mydir/tmpdir" + ".. |
static String |
removeRelative(String root,
String relative)
Use after concatenating root path to a relative path, such that "/tmp/mydir/tmpdir" + ".. |
static String[] |
split(String fullName)
Split a full file name (including path) into a string for the data path used, a String for the relative path and a third for the file name component only. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static String homeDir
public static String userDir
public static String tempDir
| Method Detail |
public static String get(String name)
name - full path to a file.
public static boolean isAbsolute(String path)
path - to check for absolute or relative type
public static String makeAbsolute(String path)
path - relative path to be made into an absolute path.
public static String removeRelative(String root,
String relative)
throws InvalidNameException
root - absolute base pathrelative - path relative to root
InvalidNameException - if ../ would go lower then lowest in provided path
public static String removeRelative(String namePath)
throws InvalidNameException
namePath - path to a file (name include .. and . elements
InvalidNameException - if ../ would go lower then lowest in provided pathpublic static String normaliseFileSeparator(String namePath)
namePath - path to be converted to a standard directory separator.
public static String localiseFileSeparator(String namePath)
namePath - path to be converted to a standard OS Dependant separator.
public static void addPaths(String pathString)
pathString - list of directory paths separated by : or ; (system dependant)public static boolean add(String path)
path - directory path, jar or zip file to add.
public static String[] getAll()
public static String[] getBases(String path)
path - that represents a data path in the directory or zip file.
public static String[] split(String fullName)
fullName - being file name including path.
public static String makeRelative(String fullName)
fullName - to parse
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||