public class PathHelper extends Object
General path rules
Modifier and Type | Field and Description |
---|---|
static String |
m_DefaultDelimiter |
Constructor and Description |
---|
PathHelper() |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsOnlyValidCharacters(String path)
Check to see if an path contains only valid characters.
|
static String |
getBaseName(String path,
String delimiter)
Given a String which specifies a path return the name of the file
or folder denoted by the path.
|
static String |
getNormalizedPath(String path,
String delimiter)
Given a path remove all relative path references and multiple path
delimiters returning a path based upon a base folder.
|
static String |
getParentPath(String path,
String delimiter)
Returns the parent part of the pathname of the path provided.
|
static boolean |
isAbsolutePath(String path,
String delimiter)
Given a String which specifies a path check to see if the path
starts with folder path delimiter.
|
static String |
removeTrailingDelimiter(String path,
String delimiter)
Given a String which specifies a path check to see if the path
end with folder path delimiter and return a string with it removed
|
static String |
resolveUpDirectoryRefs(String path,
String delimiter)
Given a String which specifies a path resolve upDirectory, and
currentDirectory references, and remove extra path delimiters.
|
static boolean |
verifyPath(String path,
boolean relativePath,
String delimiter)
Given a String which specifies a path validate that is is a valid
path.
|
protected static boolean |
verifyPath(String path,
String delim)
Given a String which specifies a path validate that is is a valid
path.
|
public static final String m_DefaultDelimiter
public static String getNormalizedPath(String path, String delimiter) throws IfsException
path
- the String which specifies the path to normailize.delimiter
- the file system delimiter to use, if null a default
delimiter of "/" is used.IfsException
- (IFS-32615) path is invalid
or IfsException (IFS-19001-0-30) no path specifiedpublic static String getParentPath(String path, String delimiter) throws IfsException
Examples with / being the seperator character:
path
- the String which specifies the path to parse and
get the parent.delimiter
- the file system delimiter to use, if null a default
delimiter of "/" is used.IfsException
- (IFS-44003) no path specifiedpublic static String getBaseName(String path, String delimiter) throws IfsException
Examples with / being the seperator character:
path
- The String which specifies the path to get the
name from.delimiter
- the file system delimiter to use, if null a default
delimiter of "/" is used.IfsException
- (IFS-32615) path is invalid
or IfsException (IFS-44003) no path specifiedpublic static boolean verifyPath(String path, boolean relativePath, String delimiter) throws IfsException
Examples of invalid paths:
path
- The String which specifies the path to validaterelativePath
- a boolean which specifies if the path is a
relative or not true = relative, false absolutedelimiter
- the file system delimiter to use, if null a default
delimiter of "/" is used.IfsException
- (IFS-44003) no path specifiedprotected static boolean verifyPath(String path, String delim) throws IfsException
Examples of invalid paths:
path
- The String which specifies the path to validatedelim
- the file system delimiter to use, if null a default
delimiter of "/" is used.IfsException
- (IFS-44003) no path specifiedpublic static boolean containsOnlyValidCharacters(String path) throws IfsException
path
- the String containing the path to checkIfsException
public static String resolveUpDirectoryRefs(String path, String delimiter) throws IfsException
Examples of resolved paths:
path
- The String which specifies the path to resolve
updirectories ondelimiter
- the file system delimiter to use, if null a default
delimiter of "/" is used.IfsException
- (IFS-32615) path is invalid
or IfsException (IFS-44003) no path specifiedpublic static boolean isAbsolutePath(String path, String delimiter) throws IfsException
path
- The String which specifies the path to checkdelimiter
- the file system delimiter to use, if null a default
delimiter of "/" is used.IfsException
- (IFS-32615) path is invalid
or IfsException (IFS-44003) no path specifiedpublic static String removeTrailingDelimiter(String path, String delimiter)
path
- The String which specifies the path to checkdelimiter
- the file system delimiter to use, if null a default
delimiter of "/" is used.IfsException
- (IFS-32615) path is invalid
or IfsException (IFS-44003) no path specifiedCopyright © 2023. All rights reserved.