Java URI Parse parseURI(String target)

Here you can find the source of parseURI(String target)

Description

parse URI

License

Apache License

Declaration

public static URI parseURI(String target) 

Method Source Code

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

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

public class Main {
    public static URI parseURI(String target) {
        target = parseString(target);// w  w w.j a  v  a  2s  .c o m
        if (target == null) {
            return null;
        }

        URI uri;

        try {
            uri = new URI(target);
        } catch (URISyntaxException e) {
            uri = null;
        }

        return uri;
    }

    /**
     * Pre-process the String object. If object is null, return null; otherwise
     * remove heading and tailing white space.
     */
    public static String parseString(String target) {
        if (target == null) {
            return null;
        } else {
            return target.trim();
        }
    }
}

Related

  1. parseServiceName(URI endpoint)
  2. parseURI(final String string)
  3. parseURI(final String value)
  4. parseURI(String connectionString, URI defaultURI)
  5. parseUri(String s)
  6. parseURI(String uriStr)
  7. parseUriParameters(URI uri)
  8. parseUriQueryParams(URI uri)
  9. parseURIs(String uri)