List of utility methods to do URI Parse
String | parseServiceName(URI endpoint) Parses the service name from an endpoint. String host = endpoint.getHost(); if (!host.endsWith(".amazonaws.com") && !host.endsWith(".amazonaws.com.cn")) { return "s3"; String serviceAndRegion = host.substring(0, host.indexOf(".amazonaws.com")); if (serviceAndRegion.endsWith(".s3") || S3_ENDPOINT_PATTERN.matcher(serviceAndRegion).matches()) { return "s3"; char separator = '.'; if (serviceAndRegion.indexOf(separator) == -1) { return serviceAndRegion; return serviceAndRegion.substring(0, serviceAndRegion.indexOf(separator)); |
URI | parseURI(final String string) parse URI return URI.create(string);
|
URI | parseURI(final String value) Parses the given String into URI without throwing any exception. try { return new URI(value); } catch (URISyntaxException e) { return null; |
URI | parseURI(String connectionString, URI defaultURI) Parses the URL provided by the user and final URI uri = parseWithNoScheme(connectionString); final String path = "".equals(uri.getPath()) ? defaultURI.getPath() : uri.getPath(); final String query = uri.getQuery() == null ? defaultURI.getQuery() : uri.getQuery(); final int port = uri.getPort() < 0 ? defaultURI.getPort() : uri.getPort(); try { return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), port, path, query, defaultURI.getFragment()); } catch (URISyntaxException e) { ... |
URI | parseUri(String s) Parses a string into a URI, as defined by RFC 2396. try { return new URI(s); } catch (URISyntaxException e) { return null; |
URI | parseURI(String target) parse URI target = parseString(target); if (target == null) { return null; URI uri; try { uri = new URI(target); } catch (URISyntaxException e) { ... |
URI | parseURI(String uriStr) Run a URI through the Java URI parser class to validate the URI. for (int i = 0; i < uriStr.length(); i++) { char c = uriStr.charAt(i); if (c < (char) 33 || c > (char) 126 || c == '<' || c == '>' || c == '\'' || c == '"' || c == '\\') { return null; try { return new URI(uriStr); ... |
LinkedListMultimap | parseUriParameters(URI uri) parse Uri Parameters LinkedListMultimap<String, String> params = LinkedListMultimap.create(); String query = uri.getQuery(); if (query != null) { for (String param : query.split("&")) { String[] kv = param.split("="); if (kv.length >= 2) { params.put(kv[0], param.substring(kv[0].length() + 1)); } else { ... |
Map | parseUriQueryParams(URI uri) parse Uri Query Params Map<String, String> params = new HashMap<String, String>(); String query = uri.getQuery(); if (query == null || query.isEmpty()) { return params; String[] keyValuePairs = query.split(URI_QUERY_PARAM_LINK_CHAR); for (String kvPair : keyValuePairs) { String[] kvSplit = kvPair.split(URI_QUERY_PARAM_KV_CHAR); ... |
ArrayList | parseURIs(String uri) parse UR Is ArrayList<String> uris = new ArrayList<String>(); int pos = 0; uris.add(uri); while (pos < uris.size()) { String u = uris.get(pos++); Matcher m = uri_param.matcher(u); while (m.find()) { try { ... |