public final class FileSystemPathUtil extends Object
| Modifier and Type | Field and Description | 
|---|---|
static BitSet | 
SAFE_NAMECHARS
The list of characters that are not encoded by the  
escapeName(String)
 and unescape(String) methods. | 
static BitSet | 
SAFE_PATHCHARS
The list of characters that are not encoded by the  
escapePath(String)
 and unescape(String) methods. | 
| Modifier and Type | Method and Description | 
|---|---|
static void | 
checkFormat(String path)
Checks if  
path is a valid path. | 
static boolean | 
denotesRoot(String path)
Tests whether the specified path represents the root path, i.e. 
 | 
static String | 
escapeName(String name)
Encodes the specified  
name. | 
static String | 
escapePath(String path)
Encodes the specified  
path. | 
static String | 
getName(String path)
Returns the name of the specified  
path. | 
static String | 
getParentDir(String path)
Returns the parent directory of the specified  
path. | 
static String | 
unescape(String pathOrName)
Decodes the specified path/name. 
 | 
public static final BitSet SAFE_NAMECHARS
escapeName(String)
 and unescape(String) methods. They contains the characters
 which can safely be used in file names:public static final BitSet SAFE_PATHCHARS
escapePath(String)
 and unescape(String) methods. They contains the characters
 which can safely be used in file paths:public static String escapePath(String path)
path. Same as
 escapeName(String) except that the separator
 character / is regarded as a legal path character
 that needs no escaping.path - the path to encode.public static String escapeName(String name)
name. Same as
 escapePath(String) except that the separator character
 / is regarded as an illegal character that needs
 escaping.name - the name to encode.public static String unescape(String pathOrName)
pathOrName - the escaped path/namepublic static boolean denotesRoot(String path)
path - path to testpublic static void checkFormat(String path) throws FileSystemException
path is a valid path.path - the path to be checkedFileSystemException - If path is not a valid pathpublic static String getParentDir(String path)
path.path - a file system path denoting a directory or a file.Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.