List of utility methods to do URI to
String | extractParamsFromURI(String uri) Extract a dispatch rule string from URI parameters (specified using example values) if (uri.contains("?") && uri.contains("=")) { String parameters = uri.substring(uri.indexOf("?") + 1); StringBuilder params = new StringBuilder(); for (String parameter : parameters.split("&")) { String[] pair = parameter.split("="); try { String key = URLDecoder.decode(pair[0], "UTF-8"); String value = URLDecoder.decode(pair[1], "UTF-8"); ... |
String | extractS3Key(URI uri) extract S Key return uri.getPath().startsWith("/") ? uri.getPath().substring(1) : uri.getPath(); |
String | extractTargetSystemFromUri(URI uri) extract Target System From Uri return uri.getScheme();
|
String | extractURIFromText(String texto) extract URI From Text try { URI uri = new URI(texto); String suri = uri.toString(); System.out.println(suri); return suri; } catch (Exception e) { List<String> uris = extractUrls(texto); for (String uri : uris) { ... |
String | toDecodedString(URI uri) Returns a string representation of the URI in a form suitable for human consumption. String scheme = uri.getScheme(); String part = uri.getSchemeSpecificPart(); if (scheme == null) return part; return scheme + ':' + part; |
File | toExistingFile(URI uri) Returns a file object for uri which points to an existing file.
File result = null; if (null != uri) { result = new File(uri); if (!result.exists()) { result = null; return result; ... |
String | toExternalForm(URI u) To fix the 3 slashes bug for File URI: For example: file:/C:/work/test.txt -> file:///C:/work/test.txt StringBuilder sb = new StringBuilder(); if (u.getScheme() != null) { sb.append(u.getScheme()); sb.append(':'); if (u.isOpaque()) { sb.append(u.getSchemeSpecificPart()); } else { ... |
java.io.File | toFile(java.net.URI uri) to File String str = uri.toString().substring(PREFIX.length()); try { return new java.io.File(new java.net.URI(str)); } catch (java.net.URISyntaxException urise) { throw new RuntimeException(str, urise); |
File | toFile(String filenameOrFileURI) to File if (schemePattern.matcher(filenameOrFileURI).matches()) { File f = new File(new URI(filenameOrFileURI)); return f; return new File(filenameOrFileURI); |
File | toFile(String unixPathOrUri) to File return isURI(unixPathOrUri) ? resolve(new File(toURI(unixPathOrUri))) : resolve(new File(unixPathOrUri.replace('/', File.separatorChar))); |