/** * @param path path string * @return path components */ public static String[] componentsFromPathString(final String path) { return cleanPath(path).split(SEPARATOR); }
/** * @return true if the given path starts with the given root * * @param path test path * @param root root */ public static boolean hasRoot(String path, String root) { String p = cleanPath(path); String r = cleanPath(root); return p.equals(r) || r.equals(cleanPath(ROOT.getPath())) || p.startsWith(r + SEPARATOR); }
/** * create a path from an array of components * @param components path components strings * @return a path string */ public static String pathStringFromComponents(String[] components) { if (null == components || components.length == 0) { return null; } return cleanPath(join(components, SEPARATOR)); }
public static Path asPath(String path) { if (null == path) { return null; } return new PathImpl(cleanPath(path)); }