List of utility methods to do Path Normalize
String | normalizePath(String absPath) Normalizes path. if (absPath.endsWith("/")) { return absPath.substring(0, absPath.length() - 1); return absPath; |
String | normalizePath(String filepath) Normalizes a file path by replacing various special path tokens (., .., etc.) with their canonical equivalents. if (filepath.startsWith("./") || filepath.startsWith(".\\")) { filepath = filepath.substring(2); filepath = filepath.replace("/./", "/"); filepath = filepath.replace("\\.\\", "\\"); int endPos = filepath.indexOf("/../"); while (endPos != -1) { int startPos = endPos - 1; ... |
String | normalizePath(String fileSystemPath) Normalizes the filesystem paths so that we only see '/' for the path separator character regardless of host operating system. return fileSystemPath.replaceAll("\\\\", "/").replace("//", "/"); |
String | normalizePath(String path) normalize Path String nPath = path.startsWith("/") ? path : String.format("/%s", path); if (!isRoot(nPath) && nPath.endsWith("/")) nPath = nPath.replaceAll("[/]+$", ""); return nPath; |
String | normalizePath(String path) normalize Path String result = path; if (path != null) { result = path.substring(path.startsWith("/") ? 1 : 0, path.endsWith("/") && path.length() > 1 ? path.length() - 1 : path.length()); return result; |
String | normalizePath(String path) Normalizes the path to make every path not end with "/". if (path == null || path.equals("/")) { return path; if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); return path; |
String | normalizePath(String path) Return a context-relative path, beginning with a "/", that represents the canonical version of the specified path after ".." String normalized = path; if (normalized.indexOf('\\') >= 0) normalized = normalized.replace('\\', '/'); if (!normalized.startsWith("/")) normalized = "/" + normalized; while (true) { int index = normalized.indexOf("//"); if (index < 0) ... |
String | normalizePath(String path) normalize Path StringBuilder ret = new StringBuilder(); int i = path.length() - 1; int end; int skipCnt = 0; while (i >= 0 && (path.charAt(i) == '/' || path.charAt(i) == '\\')) { i--; while (i >= 0) { ... |
String | normalizePath(String path) Remove relative references and "mistakes" like double slashes from the path. String result = path; result = replace("//", "/", result); result = replace("/./", "/", result); result = result.replaceAll("/[^/]+/\\.\\./", "/"); return result; |
String | normalizePath(String path) normalize Path if (path != null) { if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1) { if (!path.startsWith("\"")) { path = "\"" + path; if (!path.endsWith("\"")) { path = path + "\""; else { if (path.startsWith("\"")) { path = path.substring(1); if (path.endsWith("\"")) { path = path.substring(0, path.length() - 1); return path; |