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

URIcreate(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 = URI.create(uri.intern());
...
URIcreateAbsoluteURI(URI base, String uri)
Guarantees that the returned URI is absolute, no matter what the argument is.
return createAbsoluteURI(base, URI.create(uri));
HttpURLConnectioncreateConnection(final String uri, final String authValue)
create Connection
final URL url = new URL(uri);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(0);
connection.setReadTimeout(0);
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", authValue);
connection.setDoOutput(true);
return connection;
...
StringcreateDatastream(String registrationUri, String APIKey, String xmlDescription)
Attempts to create a new datastream.
URL datastreamRegistrationURL = null;
HttpURLConnection conn = null;
OutputStream os = null;
String result = null;
byte[] bytesToPost = xmlDescription.getBytes();
String error = null;
try {
    datastreamRegistrationURL = new URL(registrationUri);
...
StringcreateDefaultName(final String uri)
create Default Name
String last = "";
java.net.URI _uri = null;
try {
    _uri = new java.net.URI(uri);
} catch (URISyntaxException e) {
    e.printStackTrace();
if (_uri != null) {
...
URIcreateExtensionUri(final String ext)
Static helper to construct appropriate URIs for file-extensions format specifiers.
return URI.create(EXT_URI_PREFIX + ext.toLowerCase());
URIcreateURI()
Returns a random, unique URI.
return URI.create("urn:" + UUID.randomUUID());
URIcreateUri(File file)
create Uri
return file.toURI(); 
URIcreateURI(final String file)
Crea una URI a partir de un nombre de fichero local o una URL.
if (file == null || file.isEmpty()) {
    throw new IllegalArgumentException("No se puede crear una URI a partir de un nulo"); 
String filename = file.trim();
if ("".equals(filename)) { 
    throw new IllegalArgumentException("La URI no puede ser una cadena vacia"); 
filename = filename.replace('\\', '/');
...
StringcreateUri(final String path)
create Uri
if (path.contains(":/")) {
    return path;
try {
    return DUMMY_PREFIX + URLEncoder.encode(path, "UTF-8");
} catch (final UnsupportedEncodingException e) {
    throw new AssertionError(e);