@Test public void getResourceAsStream() throws Exception { InputStream is = ClassLoaderUtils.getResourceAsStream(ClassLoaderUtilsTest.class, "log4j.properties"); BufferedReader in = new BufferedReader(new InputStreamReader(is)); in.lines().forEach(System.out::println); }
public static InputStream getResourceAsStream(Class clazz, String name) { InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); if (in == null) { in = clazz.getResourceAsStream(name); } return in; }
ClassLoaderUtils { public static InputStream getResourceAsStream(Class clazz, String name) { InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); if (in == null) { in = clazz.getResourceAsStream(name); } return in; } }
ClassLoaderUtils { public static InputStream getResourceAsStream(Class clazz, String name) { InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); if (in == null) { in = clazz.getResourceAsStream(name); } return in; }  }
ClassLoaderUtils { public static InputStream getResourceAsStream(Class clazz, String name) { InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); if (in == null) { in = clazz.getResourceAsStream(name); } return in; }  static InputStream getResourceAsStream(Class clazz, String name); static String showClassLoaderHierarchy(Object obj, String role, String delim, String tabText); static String showClassLoaderHierarchy(ClassLoader cl, String delim, String tabText, int indent); }
ClassLoaderUtils { public static InputStream getResourceAsStream(Class clazz, String name) { InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); if (in == null) { in = clazz.getResourceAsStream(name); } return in; }  static InputStream getResourceAsStream(Class clazz, String name); static String showClassLoaderHierarchy(Object obj, String role, String delim, String tabText); static String showClassLoaderHierarchy(ClassLoader cl, String delim, String tabText, int indent);  }