Java Utililty Methods URI Create

List of utility methods to do URI Create

Description

The list of methods to do URI Create are organized into topic(s).

Method

URIcreateURIWithFull(final String scheme, final String userInfo, final String host, final int port, final String path, final String query, final String fragment)
create URI With Full
try {
    return new URI(scheme, userInfo, host, port, path, query, fragment);
} catch (URISyntaxException e) {
    throw new IllegalStateException("Unable to create URI", e);
URIgetUri()
get Uri
return uri;
StringgetUri(File file)
get Uri
URI uri = file.toURI();
return uri.toASCIIString();
URIgetURI(File file)
Get a URI version of the given file.
return file.toURI();
URIgetURI(File file)
Return URI for file.
try {
    return new URI("file", "", file.toURI().getPath(), null, null);
} catch (URISyntaxException e) {
    return null;
StringgetUri(File file)
Returns the URI for the given file.
String url = file.toURL().toExternalForm();
StringBuffer strBuf = new StringBuffer();
int urlLength = url.length();
for (int i = 0; i < urlLength; i++) {
    char ch = url.charAt(i);
    switch (ch) {
    case ' ':
        strBuf.append("%20"); 
...
URIgetURI(final String address)
Returns URI for the specified address.
final URL url = getURL(address);
return url != null ? toURI(url) : null;
URIgetURI(final String base, final String href)
Build URI starting from the given base and href.
if (href == null) {
    throw new IllegalArgumentException("Null link provided");
URI uri = URI.create(href);
if (!uri.isAbsolute() && base != null) {
    uri = URI.create(base + "/" + href);
return uri.normalize();
...
URIgetURI(final String uri)
Since URIs are often hard-coded, needing to catch a syntax exception is mostly unecessary.
try {
    return new URI(uri);
} catch (final URISyntaxException e) {
    throw new IllegalArgumentException("Invalid Syntax: " + uri);
URIgetURI(List data, Integer col)
get URI
if (col == null)
    return null;
Object o = data.get(col);
if (o == null)
    return null;
String s = (String) o;
return new URI(s);