@Test public void testPathSplit () { String[] paths; paths = PathUtils.split ("a:b"); Assert.assertArrayEquals (new String[] { "a", "b" }, paths); paths = PathUtils.split ("a;b"); Assert.assertArrayEquals (new String[] { "a", "b" }, paths); if (Os.isWindows ()) { paths = PathUtils.split ("/abc/def:lib/def"); Assert.assertArrayEquals (new String[] { "\\abc\\def", "lib\\def" }, paths); paths = PathUtils.split ("C:\\abc"); Assert.assertArrayEquals (new String[] { "C:\\abc" }, paths); paths = PathUtils.split ("a:C:\\abc"); Assert.assertArrayEquals (new String[] { "a", "C:\\abc" }, paths); paths = PathUtils.split ("a;C:\\abc"); Assert.assertArrayEquals (new String[] { "a", "C:\\abc" }, paths); } else { paths = PathUtils.split ("/abc/def:lib/def"); Assert.assertArrayEquals (new String[] { "/abc/def", "lib/def" }, paths); paths = PathUtils.split ("/abc/def;lib/def"); Assert.assertArrayEquals (new String[] { "/abc/def", "lib/def" }, paths); } }
public static String[] split (String path) { path = getFixedPath (path); String[] paths = null; if (':' == File.pathSeparatorChar) { paths = path.split ("[;:]"); } else if (';' == File.pathSeparatorChar) { paths = path.split (";"); ArrayList<String> pathList = new ArrayList<String> (); for (String p : paths) { String[] newPaths = splitWindows (p); for (String p2 : newPaths) pathList.add (p2); } paths = new String[pathList.size ()]; pathList.toArray (paths); } return paths; }
PathUtils { public static String[] split (String path) { path = getFixedPath (path); String[] paths = null; if (':' == File.pathSeparatorChar) { paths = path.split ("[;:]"); } else if (';' == File.pathSeparatorChar) { paths = path.split (";"); ArrayList<String> pathList = new ArrayList<String> (); for (String p : paths) { String[] newPaths = splitWindows (p); for (String p2 : newPaths) pathList.add (p2); } paths = new String[pathList.size ()]; pathList.toArray (paths); } return paths; } }
PathUtils { public static String[] split (String path) { path = getFixedPath (path); String[] paths = null; if (':' == File.pathSeparatorChar) { paths = path.split ("[;:]"); } else if (';' == File.pathSeparatorChar) { paths = path.split (";"); ArrayList<String> pathList = new ArrayList<String> (); for (String p : paths) { String[] newPaths = splitWindows (p); for (String p2 : newPaths) pathList.add (p2); } paths = new String[pathList.size ()]; pathList.toArray (paths); } return paths; }  }
PathUtils { public static String[] split (String path) { path = getFixedPath (path); String[] paths = null; if (':' == File.pathSeparatorChar) { paths = path.split ("[;:]"); } else if (';' == File.pathSeparatorChar) { paths = path.split (";"); ArrayList<String> pathList = new ArrayList<String> (); for (String p : paths) { String[] newPaths = splitWindows (p); for (String p2 : newPaths) pathList.add (p2); } paths = new String[pathList.size ()]; pathList.toArray (paths); } return paths; }  static String getFixedPath(String path); static File getRelativePath(File dir, String path); static String[] split(String path); static String toAbsolutePath(String path, File dir); }
PathUtils { public static String[] split (String path) { path = getFixedPath (path); String[] paths = null; if (':' == File.pathSeparatorChar) { paths = path.split ("[;:]"); } else if (';' == File.pathSeparatorChar) { paths = path.split (";"); ArrayList<String> pathList = new ArrayList<String> (); for (String p : paths) { String[] newPaths = splitWindows (p); for (String p2 : newPaths) pathList.add (p2); } paths = new String[pathList.size ()]; pathList.toArray (paths); } return paths; }  static String getFixedPath(String path); static File getRelativePath(File dir, String path); static String[] split(String path); static String toAbsolutePath(String path, File dir);  }