Java URI Parse parseURI(final String value)

Here you can find the source of parseURI(final String value)

Description

Parses the given String into URI without throwing any exception.

License

Apache License

Parameter

Parameter Description
value String to parse with URI#URI(String)

Return

New instance; null if the parameter is not a valid

Declaration

public static URI parseURI(final String value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.net.URI;
import java.net.URISyntaxException;

public class Main {
    /**// w  w w.  j ava2s  .com
     * Parses the given {@link String} into {@link URI} without throwing any
     * exception. In case of error null will be returned.
     * 
     * @param value
     *            {@link String} to parse with {@link URI#URI(String)}
     * @return New {@link URI} instance; null if the parameter is not a valid
     *         {@link URI}
     */
    public static URI parseURI(final String value) {
        try {
            return new URI(value);
        } catch (URISyntaxException e) {
            // Silently fail
        }
        return null;
    }
}

Related

  1. parseRegionName(URI endpoint)
  2. parseRepositoryItemUri(URI uri)
  3. parseServiceName(URI endpoint)
  4. parseServiceName(URI endpoint)
  5. parseURI(final String string)
  6. parseURI(String connectionString, URI defaultURI)
  7. parseUri(String s)
  8. parseURI(String target)
  9. parseURI(String uriStr)