List of utility methods to do Path Convert To
String | filePathToClassNameOrNull(String filePathWithExtension) Return the class name of the given java source or class file as suggested by the file path, or null if the class name could not be determined if (filePathWithExtension.endsWith(".java") || filePathWithExtension.endsWith(".class")) { String classPath = stripExtension(filePathWithExtension); String className = filePathToClassPath(classPath); return className; return null; |
String | filePathToClassPath(String path) file Path To Class Path path = toForwardSlashes(path); if (path.charAt(0) == '/') { path = path.substring(1); return path.replace('/', '.'); |
String | filePathToJavaBinaryName(final String filePath, final String separator) file Path To Java Binary Name return filePath.substring(0, filePath.length() - 6).replace(separator, "."); |
String | filePathToPackagePathOrNull(String path) Return the package name part of the given file path or null if no package name could be determined path = toForwardSlashes(path); if (path.charAt(0) == '/') { path = path.substring(1); int last = path.lastIndexOf('/'); if (last == -1) { return null; String pkg = path.substring(0, last); pkg = pkg.replace('/', '.'); if (pkg.length() == 0) { return null; return pkg; |
String | filePathToUrl(String filePath) Transforms an absolute file path in the local file system into a URL-compatible address for the file. if (filePath.startsWith("/")) { return "file://" + filePath; } else { return "file:///" + filePath; |
String | pathTo(String filename) path To String result = ""; int p = filename.lastIndexOf('/'); if (p >= 0) { result = filename.substring(0, p); return result; |
String | pathTo(String ref) returns the path to a instance node (i.e. if (ref != null) { int pos = ref.lastIndexOf("/"); if ((pos == -1) || (pos == 0)) { return null; return ref.substring(0, pos); return null; ... |
void | pathToAdjacencyList(final int[] path, final int[] adjacencyList) Convert a solution from path representation to adjacency representation . int last; last = path[path.length - 1]; for (final int p : path) { adjacencyList[last - 1] = p; last = p; |
String | pathToClassName(String path) Converts a path to class name, i.e., replaces "/" by "." return path.substring(0, path.length() - 6).replace("/", "."); |
String | pathToClassName(String pathName) path To Class Name return pathName.replace('/', '.').replace('\\', '.'); |