List of utility methods to do URI Create
URI | getURI(String bucket, String key) get URI try { return new URI("oss://" + bucket + "/" + key); } catch (URISyntaxException e) { e.printStackTrace(); return null; |
URI | getURI(String host, int port, String path, boolean isHTTPS) get URI String myUrl = isHTTPS ? "https" : "http"; myUrl += "://" + host + ":" + port + path; return new URI(myUrl); |
String | GetURI(String host, String port, String resource) Get URI if (!resource.startsWith("/")) { resource = "/" + resource; int portValue = 80; if (port.length() > 0) { portValue = Integer.parseInt(port); return new URL("http", host, portValue, resource).toURI().toString(); ... |
URI | getURI(String path) get URI if (path == null) { return null; URI uri = new URI(path); if (uri.getScheme() == null) { uri = new File(path).toURI(); return uri; ... |
URI | getURI(String path) get URI if (path.contains(":/")) { return URI.create(path); } else { return new File(path).toURI(); |
URI | getURI(String path, String name) Return a URI object for a filename with the given path URI uri; try { String URIstr = path + "/" + name; while (URIstr.indexOf(' ') > 0) { int spcLoc = URIstr.indexOf(' '); StringBuffer sb = new StringBuffer(URIstr); sb.replace(spcLoc, spcLoc + 1, "%20"); URIstr = new String(sb); ... |
URI | getURI(String protocol, String authority, String path, Hashtable params) get URI StringBuffer query = new StringBuffer(); if (query != null) { String key; for (Enumeration e = params.keys(); e.hasMoreElements();) query.append(key = (String) e.nextElement()).append("=").append((String) params.get(key)) .append("&"); if (query.length() > 0) ... |
URI | getUri(String s, String h, int p, String path) Constructs the uri string and creates a URI object. return getUri(s, null, h, p, path);
|
URI | getURI(String spec) get URI try { return new URI(spec); } catch (URISyntaxException e) { throw new IllegalArgumentException("Don't know how to convert " + spec + " to URI"); |
URI | getUri(String uriName) get Uri try { return new URI(uriName); } catch (Exception e) { throw new RuntimeException(e); |