@Test public void testPathToFile1 () { String jarPath = "file:jar-file.jar"; JarUtils.pathToFile(jarPath, ""); }
protected static File pathToFile (String jarPath, String classResource) { String path = ""; jarPath = jarPath.replace("%20", " "); if (jarPath.startsWith("jar:file:")) { path = jarPath.substring("jar:".length(), jarPath.lastIndexOf('!')); } else if (jarPath.startsWith("file:")) { if (jarPath.contains("!")) { path = jarPath.substring("file:".length(), jarPath.lastIndexOf('!')); if (path.startsWith("/") && PlatformUtils.isWindows()) { path = path.substring(1); } } else { int tail = jarPath.indexOf(classResource); path = jarPath.substring(0, tail); } } else { return null; } return new File(path); }
JarUtils { protected static File pathToFile (String jarPath, String classResource) { String path = ""; jarPath = jarPath.replace("%20", " "); if (jarPath.startsWith("jar:file:")) { path = jarPath.substring("jar:".length(), jarPath.lastIndexOf('!')); } else if (jarPath.startsWith("file:")) { if (jarPath.contains("!")) { path = jarPath.substring("file:".length(), jarPath.lastIndexOf('!')); if (path.startsWith("/") && PlatformUtils.isWindows()) { path = path.substring(1); } } else { int tail = jarPath.indexOf(classResource); path = jarPath.substring(0, tail); } } else { return null; } return new File(path); } }
JarUtils { protected static File pathToFile (String jarPath, String classResource) { String path = ""; jarPath = jarPath.replace("%20", " "); if (jarPath.startsWith("jar:file:")) { path = jarPath.substring("jar:".length(), jarPath.lastIndexOf('!')); } else if (jarPath.startsWith("file:")) { if (jarPath.contains("!")) { path = jarPath.substring("file:".length(), jarPath.lastIndexOf('!')); if (path.startsWith("/") && PlatformUtils.isWindows()) { path = path.substring(1); } } else { int tail = jarPath.indexOf(classResource); path = jarPath.substring(0, tail); } } else { return null; } return new File(path); } protected  JarUtils(); }
JarUtils { protected static File pathToFile (String jarPath, String classResource) { String path = ""; jarPath = jarPath.replace("%20", " "); if (jarPath.startsWith("jar:file:")) { path = jarPath.substring("jar:".length(), jarPath.lastIndexOf('!')); } else if (jarPath.startsWith("file:")) { if (jarPath.contains("!")) { path = jarPath.substring("file:".length(), jarPath.lastIndexOf('!')); if (path.startsWith("/") && PlatformUtils.isWindows()) { path = path.substring(1); } } else { int tail = jarPath.indexOf(classResource); path = jarPath.substring(0, tail); } } else { return null; } return new File(path); } protected  JarUtils(); static File getJarFileOfClass(Class<?> cls); static String getJarPath(Class<?> cls); }
JarUtils { protected static File pathToFile (String jarPath, String classResource) { String path = ""; jarPath = jarPath.replace("%20", " "); if (jarPath.startsWith("jar:file:")) { path = jarPath.substring("jar:".length(), jarPath.lastIndexOf('!')); } else if (jarPath.startsWith("file:")) { if (jarPath.contains("!")) { path = jarPath.substring("file:".length(), jarPath.lastIndexOf('!')); if (path.startsWith("/") && PlatformUtils.isWindows()) { path = path.substring(1); } } else { int tail = jarPath.indexOf(classResource); path = jarPath.substring(0, tail); } } else { return null; } return new File(path); } protected  JarUtils(); static File getJarFileOfClass(Class<?> cls); static String getJarPath(Class<?> cls);  }