ResourceLoader { public static AbstractFile getPackageResourceAsFile(Package ppackage, String name) { return getPackageResourceAsFile(ppackage, name, getDefaultClassLoader(), null); }  static ClassLoader getDefaultClassLoader(); static void setDefaultClassLoader(ClassLoader defaultClassLoader); static URL getPackageResourceAsURL(Package ppackage, String name); static URL getPackageResourceAsURL(Package ppackage, String name, ClassLoader classLoader, AbstractFile rootPackageFile); static URL getResourceAsURL(String path); static URL getResourceAsURL(String path, ClassLoader classLoader, AbstractFile rootPackageFile); static InputStream getPackageResourceAsStream(Package ppackage, String name); static InputStream getPackageResourceAsStream(Package ppackage, String name, ClassLoader classLoader, AbstractFile rootPackageFile); static InputStream getResourceAsStream(String path); static InputStream getResourceAsStream(String path, ClassLoader classLoader, AbstractFile rootPackageFile); static AbstractFile getPackageResourceAsFile(Package ppackage, String name); static AbstractFile getPackageResourceAsFile(Package ppackage, String name, ClassLoader classLoader, AbstractFile rootPackageFile); static AbstractFile getResourceAsFile(String path); static AbstractFile getResourceAsFile(String path, ClassLoader classLoader, AbstractFile rootPackageFile); static AbstractFile getRootPackageAsFile(Class<?> aClass); static String getRelativePackagePath(Package ppackage); static String getRelativeClassPath(Class<?> cclass);  }
@Test public void testPackageResourceAsFile() throws IOException { assertReadable(ResourceLoader.getPackageResourceAsFile(getThisPackage(), getExistingResourceName())); assert ResourceLoader.getPackageResourceAsFile(getThisPackage(), getNonExistingResourceName()) == null; assertReadable(ResourceLoader.getPackageResourceAsFile(getThisPackage(), getExistingResourceName(), getThisClassLoader(), getRootPackageFile())); assert ResourceLoader.getPackageResourceAsFile(getThisPackage(), getNonExistingResourceName(), getThisClassLoader(), getRootPackageFile()) == null; }