List of utility methods to do URI Parse
URI | parse(final String uri) Creates or obtains a new URI;. final WeakReference<URI> ref = uris.get(uri); if (ref != null) { final URI res = ref.get(); if (res != null) { return res; final URI newUri = new URI(uri.intern()); ... |
Map | parse(final URI uri, boolean decodeQueryParam) Returns Map Map<String, Set<String>> result = Collections.emptyMap(); final String query = uri.getRawQuery(); if (query != null && query.length() > 0) { result = new HashMap<>(); parse(result, new Scanner(query), null, decodeQueryParam); return result; |
String[] | parseAWSUri(URI uri, String defaultAccessKey, String defaultSecretAccessKey) Parses the userinfo username and password out of the given URI, and retuns the embedded, or default, AWS access and secret keys. String accessKey = null; String secretAccessKey = null; String userInfo = uri.getUserInfo(); if (userInfo == null) { String authority = uri.getAuthority(); String split[] = authority.split("[:@]"); if (split.length >= 2) userInfo = split[0] + ":" + split[1]; ... |
String | parseLeaf(final URI uri) parse Leaf String[] path = getPathAsArray(uri);
return path[path.length - 1];
|
Map | parseParameters(URI uri) Get properties from a URI return uri.getQuery() == null ? Collections.EMPTY_MAP : parseQuery(stripPrefix(uri.getQuery(), "?")); |
URI | parseParentURI(final URI uri) parse Parent URI String path[] = getPathAsArray(uri); if (path.length == 1) { return null; String leaf = path[path.length - 1]; int index = new StringBuilder(uri.getPath()).lastIndexOf(leaf); StringBuilder newPath = new StringBuilder(uri.getPath().substring(0, index)); URI newURI = createURI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), newPath.toString(), ... |
String[] | parsePathElements(URI uri) parse Path Elements String path = uri.getPath(); if (path == null) { return new String[0]; while (path.startsWith("/")) { path = path.substring(1); String[] split = path.split("/"); ... |
List | parsePorts(URI connectionURI) parse Ports String uriString = connectionURI.toString(); String withoutProtocol = uriString.substring(13); String[] stripes = withoutProtocol.split(STRIPE_SEPARATOR); return Arrays.stream(stripes).map(stripe -> stripe.substring(stripe.indexOf(":") + 1)) .mapToInt(Integer::parseInt).boxed().collect(Collectors.toList()); |
Map | parseQuery(String uri) parse Query int pathEndPos = uri.indexOf('?'); String s = pathEndPos < 0 ? uri : uri.substring(pathEndPos + 1); Map<String, List<String>> params = new LinkedHashMap<String, List<String>>(); String name = null; int pos = 0; int i; char c = 0; for (i = 0; i < s.length(); i++) { ... |
Properties | parseQuery(URI aURI, boolean shouldDecode) Parse the query of a URI into a set of properties. return parseQuery(aURI.getRawQuery(), shouldDecode, new Properties()); |