Code example for URI

Methods: getSchemegetSchemeSpecificPart

    private URI prepareDistributionUri() throws URISyntaxException {
        URI source = readDistroUrl();
        if (source.getScheme() == null) {
            //no scheme means someone passed a relative url. In our context only file relative urls make sense. 
            return new File(propertiesFile.getParentFile(), source.getSchemeSpecificPart()).toURI();
        } else { 
            return source;
    private URI readDistroUrl() throws URISyntaxException {
        if (properties.getProperty(DISTRIBUTION_URL_PROPERTY) != null) {
            return new URI(getProperty(DISTRIBUTION_URL_PROPERTY));
        //try the deprecated way: 
        return readDistroUrlDeprecatedWay(); 
Stop searching for code, let great code find you!  Add Codota to your java IDE