Code example for URL

0
            throw new CucumberException(e);
        } 
    } 
 
    static String filePath(URL jarUrl) throws UnsupportedEncodingException, MalformedURLException {
        String path = new File(new URL(jarUrl.getFile()).getFile()).getAbsolutePath();
        String pathToJar = path.substring(0, path.indexOf("!"));
        return URLDecoder.decode(pathToJar, "UTF-8");
    } 
 
    static boolean hasSuffix(String suffix, String name) {
        return suffix == null || name.endsWith(suffix);
    } 
 
    static String getPath(URL url) {
        try { 
            return URLDecoder.decode(url.getPath(), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw new CucumberException("Encoding problem", e);
        } 
    }