Here you can find the source of getResourceAsInputStream(Class> resourceClass, String resourceName)
public static InputStream getResourceAsInputStream(Class<?> resourceClass, String resourceName)
//package com.java2s; //License from project: Apache License import java.io.InputStream; public class Main { public static InputStream getResourceAsInputStream(Class<?> resourceClass, String resourceName) { InputStream inputStream = resourceClass.getResourceAsStream(resourceName); if (inputStream == null) { throw new IllegalStateException("Unable to find resource [" + resourceName + "] relative to class [" + resourceClass.getName() + "]."); }/* w ww .ja va 2 s. c o m*/ return inputStream; } }