Android Utililty Methods Path Normalize

List of utility methods to do Path Normalize


The list of methods to do Path Normalize are organized into topic(s).


StringgetCanonicalPath(File pFile)
get Canonical Path
String lReturnPath = pFile.getAbsolutePath();
lReturnPath = lReturnPath.replaceAll("\\\\", "/");
final String regExp1 = "()[^/]+/(\\.\\.)";
final Pattern pattern1 = Pattern.compile(regExp1);
final String regExp2 = "([^/]+/)(\\.)";
final Pattern pattern2 = Pattern.compile(regExp2);
final String regExp3 = "(/)(/)";
final Pattern pattern3 = Pattern.compile(regExp3);
FilenormalizeFile(String path)
normalize File
return normalizeFile(new File(path));
StringnormalizePath(String path)
normalize Path
return normalizePath(path, isWindows());
StringnormalizePath(String path, boolean isWindows)
normalize Path
if (path == null) {
    return null;
path = path.trim();
path = path.replace(BACKSLASH_CHAR, SLASH_CHAR);
String prefix = getSystemDependentPrefix(path, isWindows);
if (prefix == null) {
    return null;
StringnormalizeUnixPath(String path)
normalize Unix Path
return normalizePath(path, false);
StringnormalizeWindowsPath(String path)
normalize Windows Path
return normalizePath(path, true);