Java Path File Name nio getResourceRootPath(Class resourceClass, String resourceName)

Here you can find the source of getResourceRootPath(Class resourceClass, String resourceName)

Description

get Resource Root Path

License

Apache License

Declaration

public static Path getResourceRootPath(Class<?> resourceClass, String resourceName) 

Method Source Code

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

import java.net.URISyntaxException;
import java.net.URL;

import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {
    public static Path getResourceRootPath(Class<?> resourceClass, String resourceName) {
        URL url = resourceClass.getResource(resourceName);
        try {/* w  w w .  j av  a 2  s .com*/
            return Paths.get(url.toURI()).getParent();
        } catch (URISyntaxException e) {
            throw new IllegalStateException(e);
        }
    }
}

Related

  1. getProvenanceLogFiles(final String baseName, final Collection allProvenanceLogs)
  2. getQualifiedName(String outputDir, Path path)
  3. getRelativePathFile(String fileName)
  4. getRelativePathName(Path root, Path path)
  5. getResourcePath(Class resourceClass, String resourceName)
  6. getRoot(final String pathName)
  7. getRootPathFromDirectory(String resourceName, URL resource)
  8. getSimpleName(String path)
  9. getSolrCorePath(Path solrHome, String indexName)