Java Resource File getParentResource(final Class c, final String resource)

Here you can find the source of getParentResource(final Class c, final String resource)

Description

get Parent Resource

License

Open Source License

Declaration

public static URL getParentResource(final Class<?> c, final String resource) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.URL;

public class Main {
    public static URL getParentResource(final Class<?> c, final String resource) {
        String name = c.getName();
        name = name.substring(0, name.lastIndexOf("."));
        name = name.substring(0, name.lastIndexOf(".") + 1);
        name = name.replace(".", "/");
        return c.getClassLoader().getResource(name + resource);
    }//from  w w w  .j a v a2  s.co  m
}

Related

  1. getFileResource(String resourceName)
  2. getInputStream(String resourceOrFile, Class cls)
  3. getInputStreamForResource(String s)
  4. getLastModificationForResource(String resourceId)
  5. getLastModified(final String resourceName)
  6. getSampleDir(File resourcesDir)
  7. getShortName(String resource, Map nsMap)
  8. getSourceForResource(String s)
  9. getStreamFromResource(Class clazz, String resourceName)