List of utility methods to do Path Normalize
String | normalizePath(String path) normalize Path StringBuffer ret = new StringBuffer(); char[] c = path.toCharArray(); for (int i = 0; i < c.length; i++) if (c[i] == '\\') ret.append('/'); else if (Character.isUpperCase(c[i])) ret.append(Character.toLowerCase(c[i])); else ... |
String | normalizePath(String path) normalize Path if (path == null) { return null; int n = 0; for (; n < path.length(); n++) { if (path.charAt(n) != '/') { break; if (n > 1) { path = path.substring(n - 1); return path; |
String | normalizePath(String path) normalize Path String separator = "/"; return path.replaceAll("\\\\", separator); |
String | normalizePath(String path) Normalizes a path by removing trailing slash, unless the path is the root path. if (WORKSPACE_ROOT.equals(path)) { return path; if (path.isEmpty()) { return WORKSPACE_ROOT; int maybeSlash = path.length() - 1; return path.charAt(maybeSlash) == '/' ? path.substring(0, maybeSlash) : 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) { ... |
String | normalizePath(String path) normalize Path path = path.replaceAll("\\\\", "/"); while (path.startsWith("./")) path = path.substring(2); while (path.startsWith("/")) path = path.substring(1); while (path.endsWith("/.")) path = path.substring(0, (path.length() - 2)); int pathLength; ... |
String | normalizePath(String path) normalize Path if (path.length() == 2 && path.charAt(1) == ':') { path += "/"; if (isWindows()) { path = path.replace('/', '\\'); return path; |
String | normalizePath(String path) Normalize path. if (path != null && path.length() > 0) { if (System.getProperty("os.name").toLowerCase().startsWith("windows")) { return path.replace('/', '\\'); return path.replace('\\', '/'); return path; |
String | normalizePath(String path) normalize Path if (path == null || path.length() == 0) { path = "/"; } else if (!path.startsWith("/")) { path = "/" + path.trim(); } else { path = path.trim(); if (path.length() > 1 && path.endsWith("/")) { ... |
String | normalizePath(String path, char sep) Normalize a path, ensuring that it start with a '/' and does not end with a '/'. boolean needLeadingSlash = path.charAt(0) != sep; boolean needRemoveTrailingSlash = path.charAt(path.length() - 1) == sep; if (needLeadingSlash || needRemoveTrailingSlash) { if (needLeadingSlash && needRemoveTrailingSlash) { StringBuilder b = new StringBuilder(); b.append(sep); b.append(path, 0, path.length() - 1); return b.toString(); ... |