Package org.apache.jackrabbit.core.fs
Class FileSystemPathUtil
java.lang.Object
org.apache.jackrabbit.core.fs.FileSystemPathUtil
Utility class for handling paths in a file system.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckFormat(String path) Checks ifpathis a valid path.static booleandenotesRoot(String path) Tests whether the specified path represents the root path, i.e.static StringescapeName(String name) Encodes the specifiedname.static StringescapePath(String path) Encodes the specifiedpath.static StringReturns the name of the specifiedpath.static StringgetParentDir(String path) Returns the parent directory of the specifiedpath.static StringDecodes the specified path/name.
-
Field Details
-
SAFE_NAMECHARS
The list of characters that are not encoded by theescapeName(String)andunescape(String)methods. They contains the characters which can safely be used in file names: -
SAFE_PATHCHARS
The list of characters that are not encoded by theescapePath(String)andunescape(String)methods. They contains the characters which can safely be used in file paths:
-
-
Method Details
-
escapePath
Encodes the specifiedpath. Same asexcept that the separator characterescapeName(String)/is regarded as a legal path character that needs no escaping.- Parameters:
path- the path to encode.- Returns:
- the escaped path
-
escapeName
Encodes the specifiedname. Same asexcept that the separator characterescapePath(String)/is regarded as an illegal character that needs escaping.- Parameters:
name- the name to encode.- Returns:
- the escaped name
-
unescape
Decodes the specified path/name.- Parameters:
pathOrName- the escaped path/name- Returns:
- the unescaped path/name
-
denotesRoot
Tests whether the specified path represents the root path, i.e. "/".- Parameters:
path- path to test- Returns:
- true if the specified path represents the root path; false otherwise.
-
checkFormat
Checks ifpathis a valid path.- Parameters:
path- the path to be checked- Throws:
FileSystemException- Ifpathis not a valid path
-
getParentDir
Returns the parent directory of the specifiedpath.- Parameters:
path- a file system path denoting a directory or a file.- Returns:
- the parent directory.
-
getName
Returns the name of the specifiedpath.- Parameters:
path- a file system path denoting a directory or a file.- Returns:
- the name.
-