@Test public void testResourcesFromPath() throws Exception { final List<String> paths = Classpaths.resources( this.getClass(), "/org/node/file1.txt" ); String path = paths.get( 0 ); boolean ok = true; ok |= Str.in( "abc", IO.read( path ) ) || die(); }
public static List<String> resources( Class<?> clazz, String resource ) { List<String> list = listFromClassLoader(Thread.currentThread().getContextClassLoader(), resource); if ( isEmpty( list ) ) { list = listFromClassLoader(clazz.getClassLoader(), resource); } if ( isEmpty( list ) && resource.startsWith( "/" ) ) { resource = resource.substring( 1 ); return resources( clazz, resource ); } return list; }
Classpaths { public static List<String> resources( Class<?> clazz, String resource ) { List<String> list = listFromClassLoader(Thread.currentThread().getContextClassLoader(), resource); if ( isEmpty( list ) ) { list = listFromClassLoader(clazz.getClassLoader(), resource); } if ( isEmpty( list ) && resource.startsWith( "/" ) ) { resource = resource.substring( 1 ); return resources( clazz, resource ); } return list; } }
Classpaths { public static List<String> resources( Class<?> clazz, String resource ) { List<String> list = listFromClassLoader(Thread.currentThread().getContextClassLoader(), resource); if ( isEmpty( list ) ) { list = listFromClassLoader(clazz.getClassLoader(), resource); } if ( isEmpty( list ) && resource.startsWith( "/" ) ) { resource = resource.substring( 1 ); return resources( clazz, resource ); } return list; }  }
Classpaths { public static List<String> resources( Class<?> clazz, String resource ) { List<String> list = listFromClassLoader(Thread.currentThread().getContextClassLoader(), resource); if ( isEmpty( list ) ) { list = listFromClassLoader(clazz.getClassLoader(), resource); } if ( isEmpty( list ) && resource.startsWith( "/" ) ) { resource = resource.substring( 1 ); return resources( clazz, resource ); } return list; }  static List<URL> classpathResources( ClassLoader loader, String resource ); static List<URL> classpathResources( Class<?> clazz, String resource ); static List<String> resources( Class<?> clazz, String resource ); static List<Path> paths( Class<?> clazz, String resource ); static List<String> listFromClassLoader(ClassLoader loader, String resource); static List<Path> pathsFromClassLoader(ClassLoader loader, String resource); }
Classpaths { public static List<String> resources( Class<?> clazz, String resource ) { List<String> list = listFromClassLoader(Thread.currentThread().getContextClassLoader(), resource); if ( isEmpty( list ) ) { list = listFromClassLoader(clazz.getClassLoader(), resource); } if ( isEmpty( list ) && resource.startsWith( "/" ) ) { resource = resource.substring( 1 ); return resources( clazz, resource ); } return list; }  static List<URL> classpathResources( ClassLoader loader, String resource ); static List<URL> classpathResources( Class<?> clazz, String resource ); static List<String> resources( Class<?> clazz, String resource ); static List<Path> paths( Class<?> clazz, String resource ); static List<String> listFromClassLoader(ClassLoader loader, String resource); static List<Path> pathsFromClassLoader(ClassLoader loader, String resource);  }