Here you can find the source of getResourceAsStream(String resource, ClassLoader classLoader)
private static InputStream getResourceAsStream(String resource, ClassLoader classLoader)
//package com.java2s; //License from project: Apache License import java.io.InputStream; public class Main { private static InputStream getResourceAsStream(String resource, ClassLoader classLoader) { InputStream returnValue = classLoader.getResourceAsStream(resource); if (null == returnValue) { returnValue = classLoader.getResourceAsStream("/" + resource); }/* w ww . j a v a 2s. c o m*/ if (null != returnValue) { return returnValue; } return null; } }