MCPcopy Create free account
hub / github.com/BaseXdb/basex / isValid

Method isValid

basex-core/src/main/java/org/basex/io/IOUrl.java:198–207  ·  view source on GitHub ↗

Checks if the specified string is a valid URL. @param url url string @return file path

(final String url)

Source from the content-addressed store, hash-verified

196 * @return file path
197 */
198 static boolean isValid(final String url) {
199 final int ul = url.length();
200 int u = url.indexOf(':');
201 if(u < 2 || u + 1 == ul || !isJarURL(url) && url.charAt(u + 1) != '/') return false;
202 while(--u >= 0) {
203 final char ch = url.charAt(u);
204 if(!(ch >= 'a' && ch <= 'z' || Strings.contains("+-._", ch))) return false;
205 }
206 return true;
207 }
208
209 /**
210 * Checks if the specified string is a valid file URL.

Callers 1

getMethod · 0.95

Calls 5

isJarURLMethod · 0.95
containsMethod · 0.95
charAtMethod · 0.80
lengthMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected