@Test public void testNoBase() { assertEquals( new File("www.example.com/page.html"), SourceUtils.urlToFile(null, "http: }
public static final File urlToFile(File basePath, String url) { String subUrl; if (url.startsWith("http") || url.startsWith("ftp")) { int indexOf = url.indexOf(" if (indexOf == -1) { subUrl = url; } else { subUrl = url.substring(indexOf + 2); } } else if (url.startsWith("\\\\")) { subUrl = url.substring(2); } else if (url.length() > 2 && url.charAt(1) == ':') { subUrl = url.substring(2); } else { subUrl = url; } subUrl = subUrl.replaceAll("\\\\+", "/").replaceAll(File.pathSeparator, "/"); subUrl = subUrl.replace("/", File.separator); subUrl = StringUtils.strip(subUrl, File.separator); if (basePath != null) { return new File(basePath, subUrl); } else { return new File(subUrl); } }
SourceUtils { public static final File urlToFile(File basePath, String url) { String subUrl; if (url.startsWith("http") || url.startsWith("ftp")) { int indexOf = url.indexOf(" if (indexOf == -1) { subUrl = url; } else { subUrl = url.substring(indexOf + 2); } } else if (url.startsWith("\\\\")) { subUrl = url.substring(2); } else if (url.length() > 2 && url.charAt(1) == ':') { subUrl = url.substring(2); } else { subUrl = url; } subUrl = subUrl.replaceAll("\\\\+", "/").replaceAll(File.pathSeparator, "/"); subUrl = subUrl.replace("/", File.separator); subUrl = StringUtils.strip(subUrl, File.separator); if (basePath != null) { return new File(basePath, subUrl); } else { return new File(subUrl); } } }
SourceUtils { public static final File urlToFile(File basePath, String url) { String subUrl; if (url.startsWith("http") || url.startsWith("ftp")) { int indexOf = url.indexOf(" if (indexOf == -1) { subUrl = url; } else { subUrl = url.substring(indexOf + 2); } } else if (url.startsWith("\\\\")) { subUrl = url.substring(2); } else if (url.length() > 2 && url.charAt(1) == ':') { subUrl = url.substring(2); } else { subUrl = url; } subUrl = subUrl.replaceAll("\\\\+", "/").replaceAll(File.pathSeparator, "/"); subUrl = subUrl.replace("/", File.separator); subUrl = StringUtils.strip(subUrl, File.separator); if (basePath != null) { return new File(basePath, subUrl); } else { return new File(subUrl); } } private  SourceUtils(); }
SourceUtils { public static final File urlToFile(File basePath, String url) { String subUrl; if (url.startsWith("http") || url.startsWith("ftp")) { int indexOf = url.indexOf(" if (indexOf == -1) { subUrl = url; } else { subUrl = url.substring(indexOf + 2); } } else if (url.startsWith("\\\\")) { subUrl = url.substring(2); } else if (url.length() > 2 && url.charAt(1) == ':') { subUrl = url.substring(2); } else { subUrl = url; } subUrl = subUrl.replaceAll("\\\\+", "/").replaceAll(File.pathSeparator, "/"); subUrl = subUrl.replace("/", File.separator); subUrl = StringUtils.strip(subUrl, File.separator); if (basePath != null) { return new File(basePath, subUrl); } else { return new File(subUrl); } } private  SourceUtils(); static final File urlToFile(File basePath, String url); static String getDocumentSourceBaseName(final JCas jCas); }
SourceUtils { public static final File urlToFile(File basePath, String url) { String subUrl; if (url.startsWith("http") || url.startsWith("ftp")) { int indexOf = url.indexOf(" if (indexOf == -1) { subUrl = url; } else { subUrl = url.substring(indexOf + 2); } } else if (url.startsWith("\\\\")) { subUrl = url.substring(2); } else if (url.length() > 2 && url.charAt(1) == ':') { subUrl = url.substring(2); } else { subUrl = url; } subUrl = subUrl.replaceAll("\\\\+", "/").replaceAll(File.pathSeparator, "/"); subUrl = subUrl.replace("/", File.separator); subUrl = StringUtils.strip(subUrl, File.separator); if (basePath != null) { return new File(basePath, subUrl); } else { return new File(subUrl); } } private  SourceUtils(); static final File urlToFile(File basePath, String url); static String getDocumentSourceBaseName(final JCas jCas);  }